| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Comments:
<0> vbgunz: the difference you are worrying about isn't between print and repr(), but between str() and repr(). <1> ok <1> so print 1 + 1 returns str(2) whereas repr(1 + 1 returns int(2)... <1> Yhg1s: thank you! <2> anyone know how can I hide a process and the window of the process on windows in python? <0> repr(1+1) returns "2", not 2. <0> repr(), like str(), always returns a string. but notice the difference between repr(2) and repr("2"), and the lack of difference between str(2) and str("2") <1> Yhg1s: ok, I see I need to read up on it and find clear use cases for it before I jump about making ***umptions about it... I know I need to learn more. thank you again! <3> ? <4> polpak: I'm used to languages like C and Delphi... in these languages I provide the datatype with the declaration and group variables in a record or cl***. <3> Solak, the second part you can do <3> Solak, the first part isn't necissary
<3> Solak, a = 1.15; a = 'foo'; #perfectly ok <3> Solak, because variables aren't storage <3> Solak, they just reference things <5> Solak, your name means left-handed in turkish <6> cool! <7> i'm working on a bot <7> how could i tell if a person is identified to NickServ? <4> polpak: ah, so I can do something like: cl*** Coordinates: __xmath, __ymath, xscreen, yscreen ? and access Coordinates.xscreen ? <4> defcon8: hmm, I'm not left-handed. My nick is related to Star trek (a Vulcan name). <3> Solak, essentailly yes, though syntatically it'd be different <8> hm.. if a function wants a vector but my data is stored in a list.. how can i convert that? <3> cl*** Coordinates: def __init__(self, x, y): self.x = x; self.y=y; #etc. <0> Solak: there isn't a separate definition or declaration statement, in Python. just ***ignment. when you ***ign to a name, the name will start to exist. <0> this includes attributes. <0> whyking: depends on what 'a vector' is. <8> yeah <8> thats what i want to know too <8> its pylab-module <0> whyking: you'll have to ask the function you are calling. <8> if ig ive it a list: <0> or its documentation, rather. <8> name 'typecode' is not defined <8> yeah <8> it just says vector <8> what cl*** has .typecode? <5> Solak, yes <0> no builtin type. note that 'name 'typecode' is not defined' isn't talking about an attribute. <4> Yhg1s: brrr. I have to get used to that :) <0> whyking: the 'array' module has an 'array' type that has a typecode attribute, but unless the error actually mentions attributes, I doubt that's it. <8> hm <8> it sounds kind of right <0> Solak: sure, Python's a completely different language. it's easy though. <2> which module do I use to call win32api functions <2> ? <4> polpak: ah. but I don't need __init__ I guess. I can create a function that converts the coordinates. Anyway, it starts to make sense now. thanks! <0> peaceyall: 'win32api' would be the module. part of win32all (also known as pywin32 or 'the python win32 extensions') <2> oh <0> Solak: if you want cl*** attributes, ***igning to the names in the cl*** statement is it. However, you should realize that all instances of the cl*** share those attributes. <0> Solak: if you want instance attributes, you need to ***ign in __init__. <7> how could i tell if a person is identified to NickServ in python? <4> Yhg1s: ah, so the meaning of __init__ is not only to 'initialize' variables (set initial values)? <2> Yhg1s, is there a HideWindow function in win32api? <4> Yhg1s: in this case, ofcourse. <0> Solak: the meaning of __init__ is 'initialize'. it's the initializer for a cl***, called to initialize an instance after it has been created. <4> I know it isn't a 'constructor' in the C++/Delphi/Java sense of the word, but init suggests initialization. <0> (in that sense, it's quite different from a constructor, which is called to *create* the instance. Python has one of those too (__new__), but it sees much less use.) <0> Solak: yes, it is the initializer. the '__init__' name is not an accident :) <9> is there an equivalent of gedit for windows? <0> peaceyall: I dont know, I don't do Windows. <9> I downloaded gvim but I dont like it
<9> my samba server isn't working properly so I need to use windows <6> ? <8> hm.. its a real pain to use scipy and pylab together actually <0> Solak: perhaps I should explain how attribute lookup on instances work. An instance is an object with a 'cl***' (or 'type'), and a collection of instance attributes. the attributes are stored in a dictionary, instance.__dict__. <8> which is a real bummer <0> Solak: when you do 'instance.attr', Python looks in instance.__dict__ for instance attributes. If it doesn't find the attribute there, it'll look at the attributes of the instance's cl***, instead. And if the cl*** doesn't have it, on any of the basecl***es of the cl***. <0> Solak: so when you define an attribute on the cl***, all instances will seem to have it, too. but they are all shared. <10> AfterDeath, I doubt that's something anyone knows off the top of their head <11> AfterDeath: here's a guide: 1) learn how the IRC protocol works 2) learn how IRC networks report the nickserv status on users 3) combine what you've learned <0> AfterDeath: sorry, for IRC questions, you'll have to dig into IRC specs. <0> Solak: however, attribute ****ignment* works slightly different: whenever you do 'instance.attribute = x', it'll set the instance attribute, never the cl*** attribute, even if the instance doesn't have an attribute of that name, and the cl*** does. <2> AfterDeath, get the output of the whois <2> and if it says 'is identified' in the output <4> Yhg1s: that doesn't sound very different from other OO languages, or did I misinterpret something? <2> He is <0> Solak: depends on the OO languages you know. most of them aren't this dynamic by far :) And the ***ignment rule is quite different from any OO language I know. <0> (well, except MOO.) <4> Yhg1s: if I understand it correctly, attributes are inherited all the time, once defined you don't get rid of them. <0> Solak: no, you can get rid of them, using the 'del' statement. 'del instance.attribute' will remove the instance attribute (possibly unmasking a cl*** attribute) <4> Yhg1s: do you mind continuing this discussion in another window? :) <0> depends on the window; my IRC is a bit hampered right now, reinstalling my debian workstation :) <4> Yhg1s: I mean /msg :) <0> that's fine. <4> ircnet or freenode? :) <0> preferably freenode; my ircnet irssi has less screenspace :) <0> I need a minute to reboot, though. <4> Yhg1s: ok. <9> Crimson Editor is quite nice <9> you can tell that to the next marshhole that asks you what a good general purpose editor for windows is <5> how are comments done in python? <3> # this is a comment <0> defcon8: see a tutorial, any tutorial. <5> thanks <5> Yhg1s, couldnt find <5> inside the tutorial <0> which tutorial? <5> thinkcspy <12> Hello. <7> hi <12> I have a Python program that does software updates. It can also update itself. I have another legacy program that calls this program to do updates. I currently having it exit and restart itself if it gets an update of itself, but it would be PREFERABLE if it could, like in the shell, replace itself (as a process) with the newer version of itself once it's installed.... <12> I was thinking there might be some way to do this, but I'm not seeing anything that might work... <12> execfile seems like it would not work for this process.... <13> GN <11> atoi: http://docs.python.org/lib/os-process.html you might want to look at the familiy of exec*() functions <12> YES that's what I was looking for! <11> Np. :) <11> the unfortunate thing is that Python's got an exec() function which does something entirely different <14> keyword, not function <11> deltab: my bad. <14> eval however is a function <14> atoi: I recommend the subprocess module over the exec* family <11> anyways, I'm off to watch "Dead men don't wear plaid." <14> atoi: oh, exec* might actually be the best thing for this <15> first, 'and' and 'or' are equiv. to && and || in other langs, right? Second, what do I use for exclusive or, or xor? <12> yeah it seems to be exactly what I want. <0> capi_rioj: '!=' <0> capi_rioj: as for their equivalence, 'and' and 'or' are somewhat different, because they actually return one of their operands. ('and' returns the first argument that's false, or the last argument if both are true, and 'or' returns the first argument that is true, or the last value if both are false.) <16> hi <7> hi <16> im back from work finally
Return to
#python or Go to some related
logs:
ubuntu k3b device not found ntpd.conf burst GLIB >= 1.2.2 not installed ubuntu #perl #netfilter #python #proftpd PL2305 linux turn on errors in php operon+make.conf
|
|