| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Comments:
<0> you guys <0> ^^ <0> question was directed twoard all of you <1> css + php + html + java + javascript + sql == coder's hell, on earth, for free! <2> Anyone know how to interrupt a system shell process in ipython? <3> I worked on the guido van robot project: http://gvr.sf.net I think it is the greatest piece of software ever written... ha <4> subopt: on Linux, maybe you could use a pkill matching the original command line <5> Takes too long to walk? <4> subopt: but you might have to run it from another thread (or process) <2> Loge: thanks <6> what's the best way to check if something is a string? isinstance(), type(foo) == type(''),... ? <5> bytestring? Unicode-string? either? <6> er, good point <6> both, so BaseString, right? <6> so only isinstance(), correct?
<5> isinstance(xs, basestring) <6> small letters? <5> unless you're using a really big font, yes. <7> Hey, does this work? Can you see this text? I need to test commands so that I can make a plugin for Xchat, this is using a Python interpreter to write. Not sure if it works, so please answer if you can see this damned message <8> scorchsaber: I don't see it :-) <7> :D <7> Thanks <6> Pythy: :) <7> I want to try out 2 more things, if anybody has a problem with it... <6> and if it was only for bytestring, what would be the answer? <5> str <6> and still with isinstance? <5> yes <6> tx <5> jkt|: [type()'s primary usefulness is for debugging, e.g., `print type(p)'---not for altering control-flow due to type-testing, because type()-based testing won't include instances derived from the sought-after type. Also, explicit type-testing, even with isinstance(), sometimes hints that there are better approaches that should be considered.] <7> So nobody saw a message by PyScorch? <8> Pythy: I've spent a good deal of time recently debugging *my* code because some has decided to test for somecl***.__cl***__.__name__ in his code... you should also mention that one :-) <8> some *gui <8> guy um <8> scorchsaber: nope <9> scorchsaber: nope, and he wasn't connected to IRC recently either. <10> how do I prevent python from printing a space for "print str," when str is an empty string? <11> i have a string value (one byte) which i'd like to convert into its corresponding ascii integer value, how do i do this? <12> Ironhand: tried print "%s" % str? <13> ehaase, ord(mystr) ? <11> ok, thanks <14> I tried to spawn a background thread for a lenghty computation, but it only work partially. When I spawned the thread it's running and the next command is executed (changing the status), but then the UI hangs! I can't to a progress gauge, because nothing is reacting anymore. Any ideas? I have the source here: http://forums.gentoo.org/viewtopic-t-449346-highlight-.html <11> whats the meaning behind 'ord'? does it stand for something? <10> bagu: same problem <13> The ordinal position in the encoding space? <12> >>> print "a%sa" % "" <12> aa <10> actually, my mistake <10> it's the *next* print statement inserting a leading space... <12> oh.. =) <10> so ehrm... any clue how to stop that? :-) <11> ok, thanks again <12> Ironhand: what does the code look like? <11> is there such thing as a switch statement in python? <15> no <5> Ironhand: sys.stdout.write('a');sys.stdout.write(''); sys.stdout.write('b') #==> ab <10> >>> str = ''; print str, ; print 'a' <10> a <10> thanks Pythy, I ***ume that's the easiest way then <12> you could continue with formats <10> well, this is not the *actual* code, but shows the problem <5> if s: print s, <12> yeah, that too <11> is there a replacement for a switch statement in python? <10> that may be the best option, thanks <5> ehaase: if/elif, or, a table-lookup to find the function to be called. <16> hi <17> yo <18> Hello all <18> How can I get the ASCII value of a char? Because simply using the int function doesn't work <11> Pythy: thanks <11> Hylk0r: ord() <19> ord() <18> wow, thanx :p <20> if x is a cl*** variable of cl*** C, do you always have to refer to it as C.x inside C?
<21> gzl, yes, otherwise you'd be refering to the variable x in the local method. <5> gzl: inside a method, you mean? If you didn't, how would Python know whether `x = 1' is to mean `C.x = 1', or, to create a local-variable `x'? <21> gzl, you can use "x = C.x" to make the local variable x refer to the cl*** variable x. <20> ok. <19> what about for immutable objects, what if x changes, C.x won't change? <20> and the same goes for cl*** methods? <20> you have to write Cl***.foo() and not just foo() ? <19> or vice-versa. <5> correct: <5> >>> cl*** C: <5> x = 0 <5> def m(self): x = C.x; x+=1; print C.x, x <5> >>> C().m() #==> 0 1 <20> no, I mean, *within* the definition of cl*** C, do you have to refer to that as C.m() ? <5> C doesn't exist yet. <22> dsuch : and what do you think about cherry ? <8> I prefer peaches. <8> But hey, cherries are OK too :) <5> C only comes into existence after Python has finished reading the entire cl***-def. <8> Pythy: >>> cl*** C: <8> ... x+= 1 <8> ... <8> >>> cl*** C: <8> ... x+= 1 <8> eh <8> NameError: name 'x' is not defined <22> ehh ;-) <5> dsuch: why would you expect otherwise? <8> Pythy: it doesn't need to read the whole cl*** definition then? <5> eh? <21> dsuch, "x += 1" means get the value of x, add one to it, and set that to the new value of x. <5> `x += 1' == `x = x + 1' # what's in x on the right hand side? <21> *But* x doesn't exist until you ***ign something to it. <21> So it can't get the value of it, hence you get that error. <8> it exits as soon as it discovers that x ain't defined in that scope? it has no chance to read (non existant in that example) methods definitions? <8> I know ebel :-) <8> wait <8> um <8> Pythy: I completely misread your statement... <16> Pythy: how long have you been coding in python if you don't mind me asking ? <5> xroberx: About three years ago is when I first picked it up. <5> 2.3 was the first version I tried. <16> you have a very good knowledge :) <19> pure genius is what I call it. <5> xroberx: Not yet. <18> what is the reverse function of ord? <19> chr() <5> chr() & unichr() <18> WOW, y'all are so smart, where the hell do y'all find these functions? <19> library reference. <19> python 2.4 quick reference. <19> our memory. <5> The Post-It on my desk. <19> help(__builtins__) <18> ok, I gues I should read the reference more detailed, since I never find the functions although I do look in the reference :p <18> sysfault: that's one to remember :p <14> chr <5> http://doc.python.org/lib/built-in-funcs.html <18> Is there a function to convert an int to bin? in example: bin(4) returns 100 <5> ?>i2b@hylk0r <5> hylk0r: (Why do you need it, BTW?) <18> Pythy: i'm working on some sorta encryption :p <11> whats the difference between popen() and spawn()? <18> Pythy: i2b() doesn't exist, atleast not as a built-in function <5> hylk0r: Look at the URL the bot PM'ed you. <18> ok, thx :p <18> i'il take a look :p <11> is 'strip' in a module? <5> ?>strmtd@ehaase <11> i just need to remove a newline at the end of a string, strip() is what i shoul duse? <5> ' \t a b \r \n \t '.strip() #==> 'a b' <23> hi all <18> Ok, I've got a pretty stupid question, but why does: <18> print "Loopz0r: ", Loopz0r
Return to
#python or Go to some related
logs:
gentoo fuhquake cfg how to install a theme onto ubuntu vga 0x344 #css pam-login + shadow + openssh gentoo python read binary file to ansi #gimp sceema ion3 screenshot how to do a circle with gimp
|
|