@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21



Comments:

<0> tkm.Button(rootp, text=" %s " %ss, relief=style, borderwidth=4, background="#0080F0", foreground='#F0FF0F', command=on_butpress).pack()
<0> rootp.mainloop()
<1> u said import test is a line in test.py
<2> kaushal: Stop typing "u". It's "you".
<1> sorry for that
<0> Kayoushal: That's OK.
<3> I guess I should take a step back first. How to generate the data for the map in the first place from the data in the database.
<1> so my script will look like
<1> #/usr/bin/python
<1> import test
<1> print __name__
<1> is that correct
<2> kaushal: No.
<2> Just "print __name__".
<2> Save it as test.py.
<4> thanks Pythy



<2> And then run, "python test.py" and "python -c 'import test'".
<1> ok
<0> defcon8: tk will allow you to use images for your button-legends, including images with a transparent-background, which you could position atop buttons with `relief="flat",' allowing you to have the appearance of different shapes. Did you test what I pasted?
<1> what does -c option means
<5> man python
<0> woman ruby
<2> woman: command not found
<0> Sanxiyn: *First* you need to acquire the Rubies.
<4> hermaphrodite ruby
<5> defcon8: i thought better of that one, myself :-P
<2> defcon8: +1
<4> :D
<1> Thanks sanxiym
<1> Thanks sanxiyn
<6> bool("False") -> True. I'm looking for a function with the other behavior. Any pointers? Thanks.
<6> (other than eval!)
<2> davidmccabe: Write one yourself, really.
<6> Wouldn't be hard; I'd just prefer to use a standard python function if there is one.
<2> if s in ("f", "false", "False", "n", "no"): return False
<2> etc.
<0> f = "True".__eq__
<0> map(f, ["False", "True"]) #==> [False, True]
<7> return s.lower() in ('t', 'true', 'y', 'yes', '1')
<2> "> The best IDE is the one tat you can be most productive in"
<2> "Nonsense. emacs is the best tool for everyone! </F>"
<2> (seen on c.l.py)
<6> hehe.
<6> well, thank you all for your suggestions.
<8> is there a way to get a list of all packages you can import?
<0> help('modules')
<8> Pythy: thanks, do you know how to get that list using python code?
<7> JFC, I must have a zillion modules on my system...
<0> ignacio: http://www.straightdope.com/cl***ics/a1_033
<0> (Or has someone started a new chain of fried-chicken restaurants?)
<9> Is this the right venue for mod_python questions?
<7> #python.web
<9> ignacio, thanks.
<10> Pythy - you remember my closure problem from yesterday evening? I now that I can solve it by defining my closures like foo(a=a) now, however I still don't really understand it, I summed it up a little bit here: http://pastebin.com/632222
<0> Mod? That was big in the 60's wasn't it?
<7> The only thing you'll get about mod_python in here is derision.
<9> ignacio, Why?
<7> Too many reasons.
<11> mod_python... well, it's a pain.
<9> ignacio, Please name one big one.
<7> You have to bounce Apache if you change the scripts.
<9> ignacio, I don't know anything to compare it to.
<0> pyqwer: Those 38 lines are the summary? Give me the summary of the summary: What part of my explanation was unclear to you?
<7> CGI, WSGI, <Python-based framework>+mod_rewrite...
<10> Pythy: Well what I don't understand now is why the functions are all different, but why they keep only one reference to 'a'.
<0> pyqwer: What part of *my explanation* was unclear to you?
<11> PSP is nice, but output and indenting and stuff...
<2> ignacio: Well, mod_python can be WSGI server.
<11> Yuck.
<10> Pythy: So my first idea was that every iteration has its own namespace - but this is obviously not true.
<2> mod_rewrite + proxy maybe better I agree.
<12> pyqwer: both of the first two functions are referring to the global version of 'a', because for loops don't have local namespaces
<10> Pythy: And I know that Python has a shortcoming so that closures in loops are also visible in the outside.
<12> but function default values are evaluated when the function is defined, so the second version(s) keep the values of 'a' as of compile time rather than at runtime
<0> "closures in loops" > What "closures in loops"?
<2> Pythy: Rather, loops don't form closure.



<2> Pythy: Among "suites" (defined as colon followed by newline followed by indent and then dedent), only def and cl*** introduces closures.
<12> try this: put a=A() at the top of the final loop
<13> sanxiyn: nope, only def.
<2> Yhg1s: Okay.
<13> sanxiyn: cl*** introduces a scope, but not a closure.
<2> Okay sure.
<0> Sanxiyn: 302 Found --> pyqwer
<12> at then you'll get a different 'a' each time. The first two times, it will be a new 'a', the second two, the values from a=a above, and then back to new ones again
<10> WalterMundt: You mean like this: http://pastebin.com/632233 - this makes no difference.
<12> wow, that almost never happens to me
<0> segfaulted Python?
<12> nope, got dropped from IRC
<12> though segv'ing Python has only happened due to a pygtk bug
<12> ...which was already fixed in the newest version when I hit it, I'm just behind
<14> HiddenWolf, I have a daemon I'm writing which is started with ./kdb start ; when ./kdb stop is executed, it's suppose to send SIGTERM to the pid (stored in a pidfile). The running daemon has handlers for SIGHUP and SIGTERM which do work. However my stop function, whihc only has os.kill(...) in a try-except seems to want to kill the pid twice
<14> $ ./kdb stop
<14> Killing PID 29996
<14> -- kdb Stopped
<14> Killing PID 29996
<14> obviously it then throws an exception: OSError: [Errno 3] No such process
<0> Yhg1s: Sanxiyn showed this to me earlier:
<0> >>> x = 90
<0> >>> cl*** C: x=x+10; print x, locals()['x'] #=> 100 100
<13> Pythy: yes: a scope but not a closure. The reason that 'x=x+10' works is that it's not an optimized-local-scope, like functions are, but it's still a scope (but not a closure)
<0> Yhg1s: My initial reaction was that he was showing me another example of Pythonic inconsistency.
<13> sure.
<15> How can I build a string of specified length which contains only whitespaces without using a loop?
<0> ' '*100
<15> Pythy: is this the same as ' '.100 in Perl ?
<16> Hi all. Is there a way to cancel shell commands opened with os.popen?
<15> yes it is, thank you
<0> Which OS?
<15> JPohlmann: AFAIK os.popen() is obsolete
<16> HowardTheCoward: And what should be used instead?
<16> Unices and Linux.
<14> JPohlmann, use the popen2 library
<0> os.popen() is fine. There's also ?.subprocess@#
<0> http://doc.python.org/lib/module-subprocess.html
<13> os.popen2() isn't a replacement for os.popen(), it just offers different functionality.
<13> subprocess, however, is a (good) replacement for both.
<15> JPohlmann: subprocess
<16> Ah, thanks.
<17> hi, is there a way to get host cpu usage from python ? (w/o parsing /proc/some_file)
<18> hi ever one
<15> sKaBoy: you don't have /proc on every os
<17> maybe i've found it.. module "resource"
<13> HowardTheCoward: no, ' '*100 is the same as ' 'x100 in perl.
<17> HowardTheCoward, yeah i know, i _don't_ want to parse a file in proc :)
<13> sKaBoy: resource only counts for the current process.
<18> can i write a module to go to a link and download an image and save the downloaded image with a specific name
<13> vorojak: the module is already written; use urllib.urlretrieve.
<18> nice
<18> so i only have to import urllib.urlretrieve
<13> no, import urllib, call urllib.urlretrieve.
<17> Yhg1s, oh.. better than nothing.. do you know anything that work for the whole system ?
<13> sKaBoy: nope.
<17> ok, thanks
<18> no doc ??
<18> where is a document for this mocule then ?
<0> urlretrieve() (in module urllib): http://doc.python.org/lib/module-urllib.html#l2h-3185
<12> ...too slow
<15> vorojak: or pycurl, or mechanize
<15> Yhg1s: the output of ' '*100 looks the same, what's the difference then ?
<12> HowardTheCoward: ' '*100 => 100 spaces. In Perl ' '.100 = " 100" (. is concatenate)
<13> and ' 'x100 => 100 spaces
<18> woow thx
<15> WalterMundt, Yhg1s: my mistake, I was meaning ' 'x100 in Perl, it was such a long time ago :)
<16> Hmm. After creating a subprocess with subprocess.Popen, I tried to kill it again with os.kill(mySubProcess.pid, signal.SIGKILL) but the process still continues.
<19> how do i insert an item into a list at a particular point instead of just appending it?
<16> pembo13: list.insert(index, item)?
<19> hm
<16> Or list[index] = item.
<19> interesting how my book neglects to mention the insert method


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

wincvs extra line feeds checkout
#gentoo
#perl
emerge crashes
Win95-Image
kcontrol other languages
#css
3D matrix transformations +c++
#perl
xen+mandriva+veth1



Home  |  disclaimer  |  contact  |  submit quotes