| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Comments:
<0> tirkal: okey doke. thanks for the explanation <1> import foo-bar ***igns a module object to the *name* foo-bar <2> chizang: you're welcome. just remember that the same restrictions that apply to all Python names apply also to module names. <0> tirkal: sounds good <1> i believe import is a keyword <2> yes, it is. <2> but the imported module still ends up being a name. <0> so, let's say that i modify foo.py (in my text editor).... how would i unload/reload the foo module from the interpreter? <1> chizang, youu can't really unload a module fully. as for reloading, you can type <2> reload(foo) <1> foo = reload(foo) <2> no need for the "foo =" part <0> bingo <1> tirkal, you're wrong there <1> reload() returns the module object
<2> kbrooks: oh? check it yourself. <1> it does not refresh the cached module <3> it does return the module object, but you don't have to do anything with it <4> how do i break a print over several lines? <4> or more like.. how can i break one into two lines <4> tried using '\' but then i got lots of whitespace in the output <5> you mean like print 'foo\nbar' ? <6> Hi everyone. I am a newb and I just started programming. I was reading the "How to think like a computer scientist" textbook and I was wondering if I need to have a VERY good knowledge from trigonometry , algebra and math in general in order to begin studying python. Cause I had a bit of problem with the sin,tan,cos and etc. Any comments? <4> HappyFool: more like i want to break a long line into two, to make the source code more readable <3> trig: definitely no. <5> or like print 'foo,'<real newline here>print 'bar' <3> zamba: print "foo"+(newline)bar <5> oops <5> , comes after the quotes <4> like: print "this is a very long line, with some %s variables %s here and %s there" % (function_that_does_****(blah), yo, another_function_and_so_on(buh)) <5> hmm <3> unless you are actually writing an app that uses trigonometry, you wouldn't need trig for python. a more general idea of logic/discrete math is far more useful for learning programming <5> maybe myvals=(function_that_does_****(blah), yo, another_function_and_so_on(buh)) <5> and then print "blah %s etc. ... " % myvals <4> nono, i want to break the text <4> HappyFool: you're answering the wrong question now :) <4> forget the functions <4> this: <4> print "lablslmldkm ldkmf glkdng lkdfng skdfj ngslkdjng slkdj ngslkdj nlksdlkgnsdlk jgslkd nlks nkgd IT'S SO LONGlmslkmfsdlfmslkfmslk but i just want it on one line" <4> the output should be on one line <4> but in the source code i want to break it into more lines <6> mcmillen: thnx :) <4> to make it more readable <3> zamba: what doesn't work with print ("this is a long" + \ <newline> "line that i am using" % (some, args, here)) <6> mcmillen: I feel more relaxed now :P <4> mcmillen: ah, you didn't specify the '\' earlier <3> ah, sorry :) <4> nah, that doesn't work either <6> another question: when i type id(3) i get a unique identifier for 3. Is the identifier ***igned that very moment or it was ***igned all that time? <5> try this: print ("foo"<newline>"bar") <4> TypeError: not all arguments converted during string formatting <4> yeah, that worked <4> HappyFool: thanks <4> but then i need to use ()? <5> didn't know python did that C join-the-strings thing <5> yeah <4> got an alternative without the ()? <5> can't you prebuild the string into a variable and then print it ? <5> or use sys.stdout.write or use print "foo", <newline> print "bar" (, adds a space, though) <3> zamba: print "foo" \ <newline> "bar" works <4> mcmillen: python version? <3> 2.4.1 <4> oh, now it worked? <4> woot? :) <3> Ghawk: if you're just learning python, you shouldn't have any reason to use id()... but given that, i think the id() for a built-in is "there" ever since interpreter startup <3> so "it was ***igned all the time" <6> I have this problem that I can't remember something or learn it by heart if I don't understand it completely :| <6> thnx :) <7> is danh here? wanted to tell him to stop using my nick before i kill his <1> danh is not danh^ <7> nope <1> and danh^ is not danh <1> danh mght have chosen his nick beforrre you <8> there
<1> oh **** <1> **** this <1> **** that <8> sorry, i give up <1> danh, change your nickname <9> "TypeError: 'module' object is not callable" <9> What causes this? <10> import os; os(1, 2, 3) <9> thanks <11> how can I get the difference of two lists? <10> You could use a couple sets <12> take the intersection. <11> yes, I was just wondering if there was a way without using sets <13> Is using ConfigParser for persistent objects besides configuration being stupid? I didn't want to use pickle because root has to load the file with data created by untrusted users and I've read pickle is advertized as not safe enough. <14> well, it'd be like comparing your two kidneys without anesthesia. <12> use a loop idl. <14> it's possible, if you know what you're doing, but it's painful. <11> Yhg1s: well, the + operator works on list so why not -? <15> idl, Why not use sets? Is it that you care about order? If so, what does [1,2,3,4] - [4,2] yield? <14> idl: + concatenates. if - did anything, it would remove a tail end. lists are not sets. <16> Yhg1s: i need some help pls. :) i am using web.py and cheetah. i am trying to use the following cheetah code: #for $author in $authors <16> $author.person.fullName <16> #end for <14> goinup: I don't do cheetah. <16> Yhg1s: what should my python code look like? <16> Yhg1s: oh? whys that? <16> Yhg1s: i am having a b*tch of a time with this for loop.. <14> because I have no need to. <10> Yhg1s: but web.py is cool? :) <15> goinup, Why are you latching on to Yhg1s? <11> CardinalFang: no reason, I guess I will, I just wasn't sure I had to <14> exarkun: threads are cool too. <14> exarkun: and Windows. <16> CardinalFang: sorry, thought that Yhg1s might have known <10> goinup: maybe somebody in #python.web knows <15> idl, You don't /have/ to -- but sets are going to be much cheaper for large "sets". <16> exarkun: thanks ill ask. this problem has been bothering me for about a week. the code isn't working how i thought it would. <15> idl, For small sets of data, lists will be completely fine. <10> Yhg1s: I invented the Hippo. <17> exarkun: does it fly? <10> Sulis: It's a hippo, dude. No it doesn't fly. <14> so it's broken? <10> Speaking of stuff that's broken <1> lol <14> Sulis: well, technically, neither is exarkun. <10> cursor.execute("SELECT foo FROM bar WHERE baz IN (?)", set) - what's the way of spelling that which actually works? <14> exarkun: I suspect there is no way. <10> what :( <14> well, other than escaping elements manually. <10> dbapi is bad. <14> or 'IN (%s)" % (",".join(['?'] * len(set)), set)' <15> Or creating a temp table and for item in set: #insert item; .... "select where baz in (select item from temp)" <14> I haven't researched it in depth, though. there may be a way, but if so, it's hiding. <10> That is better than manually escaping. I guess I'll do that. <14> depending on the database, CardinalFang's temp table idea is either impossible, or faster. <10> Set is probably never larger than 10 or so elements <18> exarkun! <14> well, 'IN (set)' is often not optimized into a table join, whereas using a temp table (where possible) usually is. The difference would be measurable with a set of two elements, if the selected table is large enough. <10> Oh :( <10> datazone: hi <18> you going to be at pycon, right? <10> as it turns out, no <18> what1 <14> but if the database doesn't support subselects (or at least not efficiently), or IN is implemented efficiently, or the table is not too large, it probably doesn't matter. <14> exarkun: shame. <14> too many people aren't going to pycon :( <10> datazone: too expensive, not enough tangible benefits <18> geez <19> hello all <19> anyone with asyncore/chat experience? <10> Poromenos: don't take polls <10> Poromenos: just ask your question <19> how do i send data to a listening socket?
Return to
#python or Go to some related
logs:
#bash #web #egghelp #linux #centos reinsall GRUB debian php_mysql.so freebsd 6.1 Can't call method send_receive on an undefined value cannot open shared object file ubuntu ioncube #lisp
|
|