| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Comments:
<0> if var: <0> print 'i exist' <1> tom_elam: you could, but not with a stdlib module. there's a third-party module for it, though. <0> armenb: you can wrap the variable name in a bool() <1> armenb: why don't you already know? Just ***ign a special variable to the variable to start with <1> sysfault: heh, not really. <1> armenb: the usual Python idiom is 'var = None', then later test with 'if var is None:' <1> sysfault: 'if var' throws an exception when var isn't defined yet because var isn't defined yet, not because it's syntactically incorrect.
<2> Yhg1s, "if var" is incorrect syntax <2> Yhg1s, he added in : <3> Yhgls: i'm kinda new to python, but i'm surprised there isn't some standard module for this. what about sysv semaphores? <1> kbrooks: oh please. <1> tom_elam: same story. <2> Yhg1s, OK. <0> Yhg1s: what? if var: throws an exception only if var does not exist. <0> i may have misunderstood your above statement. <1> sysfault: ... yes. which was armenb's point. <1> sysfault: he was looking for a way that didn't throw an exception. <2> <1> sysfault: 'bool(var)' also doesn't work, for the record. <0> yea it raises an exception for undefined variables. <0> just like the if. <1> exactly. <4> np: ITC.SDF-GuidoVanRossum.1-2005.02.17.mp3 <0> now i know why it should be set to None first. <3> Yhgls: where's a good place to read about `a stdlib module'? <1> tom_elam: docs.python.org/lib <3> Yhgls: thanks! I think I can take it from here... <4> sick <4> guido works for google now <4> :O <5> hi. I'm new to Python. I'm reading the tutorial about modules. Is there a quick way to load all the *.py files in a subdirectory specified by a path supplied to the argv? <1> tom_elam: btw, there is no 'l' in my nick, just a '1'. <3> Yhg1s: oops! Sorry! <5> I'm thinking about using straight Python as configuration files for a script I'm writing. <6> tnks: see ConfigParser for configuration files, it's pretty neat <7> warning: ConfigParser does funny things to your files <7> lowercases the keys and adds spaces around the =s <5> sTeVuu: interesting, but my input involves a lot of long strings that might have miscreant characters that would need delimiting otherwise. I was hoping to just use """ to manage it.
<7> somewhat easy to fix though, http://rafb.net/paste/results/653W6U55.html is what i did to make it usable for freedesktop.org .desktop file <1> tnks: so what's stopping you? you may be interested to read about packages (directories with __init__.py's in them), __import__, os.listdir, maybe execfile. <3> Yhg1s: Is this what you were referring to when you mentioned stdlib modules: http://www.python.org/doc/api/includes.html <5> Yhg1s: I'll see if I can find it. If you have a quick link, though, I'll take it. <1> tnks: to all of those? docs.python.org/lib. <1> __import__ and execfile are in the builtin functions section. os.listdir is in the 'os' section. <1> packages are explained in section 6.4 of the tutorial: http://docs.python.org/tut/node8.html#SECTION008400000000000000000 <1> tom_elam: no, I was referring to docs.python.org/lib <1> tom_elam: that's the library reference. it documents the standard library ('stdlib') <8> how do i kill a thread in python from within the thread i want to kill? sys.exit() ? <1> tom_elam: docs.python.org/api (which is the same thing as www.python.org/doc/api) documents the C API to Python, for extending and embedding Python. <3> Yhg1s: I hadn't heard it called `stdlib' before. <1> endeavormac: sure, or any exception will do. or you can just make it end the original function. <8> ok, thanks <1> tom_elam: sorry, that's standard terminology in the python community. <3> Yhg1s: sorry, I looked all through the index & module list in docs.python.org/lib and couldn't find the kind of semaphores that can be shared by different processes. I need a key or name to access them in different processes. <9> hi there <1> tom_elam: eh? I told you there wasn't a way in the stdlib :) <9> newbie here. i got some problems with Gtk TreeStore sorting <9> is there any simple example of how to sort a floating column? <9> s/floating/float <4> hey <4> guido is a likeable guy <3> Yhg1s: yes, sorry, I am grossly sleep deprived. ;-) <4> i'm listening to his presentation. <3> Yhg1s: can you refer me to the 3rd party implementation, please? <1> tom_elam: Google tells me http://www.ka.sara.nl/home/walter/python-ipc/ <3> Yhg1s: otherwise, I guess I'll have to figure out that old 2-phase commit stuff I heard about an eon ago. <9> anyone any idea? <1> tom_elam: well, there are more ways to communicate between processes. mmap, for instance (the mmap module exposes it.) Pipes, sockets, fifos, files. <3> Yhg1s: okay, thanks! I'll take it from here now... Thanks a lot, really! <1> paniq: yes, he really is. <10> paniq: what's his presentation on? <4> building of an open source group <4> http://www.itconversations.com/shows/detail545.html
Return to
#python or Go to some related
logs:
amsn Initialization of the Audio/Video Plugin failed unhandled interrupt panic ubuntu unix abi #linux python file seek SEEK_END #linux ubuntu Strings command package #sed yum install transcode livna #python
|
|