Re: os.path.expanduser('~/foo') and MSWindows "My Documents"

2005-11-18 Thread dalius . dobravolskas
python >>> import os >>> help(os.path.expanduser) >>> import platform >>> platform.system() 'Windows' >>> platform.release() 'XP' >>> :-) Dalius -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question: does file("text.txt', "w").write("stuff") ever get closed?

2005-11-18 Thread Fredrik Lundh
"John Doe" <[EMAIL PROTECTED]> wrote: > In an effort to avoid another potential mistake, I am wondering if the > anonymous file object/class/thingy that I create when I do file("text.txt', > "w").write("stuff") gets closed properly on exit or garbage collection or > something yes. > or if I alwa

Announce: PythonD 2.4.2 r 1.0 for DJGPP/DOS/Windows

2005-11-18 Thread bdeck
Hello, We have uploaded binary and source packages of PythonD 2.4.2 release 1.0 for DJGPP/MSDOS/Windows to the 'pythond' page at http://www.caddit.net. All PythonD users are encouraged to upgrade. There have been many enhancements, including: Smaller & faster executable size. Long Filename TSR u

need help about time.sleep, timer

2005-11-18 Thread Sinan Nalkaya
hello, i need a function like that, wait 5 seconds: (during wait) do the function but function waits for keyboard input so if you dont enter any it waits forever. i tried time.sleep() but when i used time.sleep in while, the function in while never executed. then i found something about Timer

Re: Announce: PythonD 2.4.2 r 1.0 for DJGPP/DOS/Windows

2005-11-18 Thread Claudio Grondi
I have read the announcement and checked out the homepage, but I am still missing the point. May someone explain to me, what PythonD is good for? In my eyes there is sufficient support for networking and OpenGL in Python, so why another not compatible version? Claudio "bdeck" <[EMAIL PROTECTED]>

Ajax for the Developers

2005-11-18 Thread Sabin.A.K, Bangalore
Seen that AJAX makes the Python interfaces bit more User friendly. The Page refresh problems for the huge applications has slashed down extensively. Page reload has been faded out and eventually the Server responses been printed out in the same page itself. The trendy XML HTTP Request has really st

Re: Ajax for the Developers

2005-11-18 Thread Jean-Roch SOTTY
Le Vendredi 18 Novembre 2005 10:08, Sabin.A.K, Bangalore a écrit : > 1. Changing state with links (GET requests) > 2.Asynchronously performing batch operations > 3.Breaking the back button I'm looking for a response with Python MVC frameworks -- django, turbogears, etc. But you could cons

Column not updating in listbox in wxPython example ??

2005-11-18 Thread David Poundall
In the following example the phone number does not apear in the phone column of the llistbox. Can anybody tell me what I am doing wrong here ? from wxPython.wx import * class MyApp (wxApp) : def OnInit (self) : frame = MyFrame(NULL, -1, "Phone List") frame.Show(true) self.Se

Re: sqlite utf8 encoding error

2005-11-18 Thread Manlio Perillo
On 17 Nov 2005 03:47:00 -0800, "Greg Miller" <[EMAIL PROTECTED]> wrote: >I have an application that uses sqlite3 to store job/error data. When >I log in as a German user the error codes generated are translated into >German. The error code text is then stored in the db. When I use the >fetchall

Re: Default method arguments

2005-11-18 Thread Gregory Petrosyan
Thanks Martin, you are right. -- http://mail.python.org/mailman/listinfo/python-list

Re: Announce: PythonD 2.4.2 r 1.0 for DJGPP/DOS/Windows

2005-11-18 Thread Harald Armin Massa
Claudio, maybe it's because PythonD is running within DOS? (which, for archaelogical completeness, is an ancient operating system) Harald -- http://mail.python.org/mailman/listinfo/python-list

Re: Default method arguments

2005-11-18 Thread Peter Otten
Martin Miller wrote: > Well, perhaps the same in the sense of name binding, but there's a > subtle difference in replacing the 's = [n]'  with 'foo.s = n'.  Namely > that in the former case (with the essay's original code) a separate > container is created when foo() is first called and is what is

nanothreads: Want to use them from within wxPython app

2005-11-18 Thread F. GEIGER
I've def'ed a handler for EVT_IDLE in the app's main frame. There I'd like to call the nanothreads' __iter__ method, somehow. When I copy the __iter__ method into a, say, runOnce() method and call the next() method of the generator returned by runOnce(), it works. But I can't get at the __iter_

Re: Immutable instances, constant values

2005-11-18 Thread Bengt Richter
On Fri, 18 Nov 2005 14:32:46 +1100 (EST), Ben Finney <[EMAIL PROTECTED]> wrote: >Howdy all, > >I've recently packaged 'enum' in PyPI. In its description, I make the >claim that it creates "immutable" enumeration objects, and that the >enumeration values are "constant" values. > >This raises questi

Re: Zope vs Php

2005-11-18 Thread Jorge Godoy
Mike Meyer <[EMAIL PROTECTED]> writes: > Unfortunately, my tools don't - which is another one of the things I > like about Cheetah: it doesn't interfere with my X/HTML tools. For > instance, I edit attributes by asking the editor to let me edit the > current tags attributes. It opens window with a

Re: How to write an API for a Python application?

2005-11-18 Thread Duncan Grisby
In article <[EMAIL PROTECTED]>, Cameron Laird <[EMAIL PROTECTED]> wrote: [...] >Indeed, Paul: those who scorn CORBA often *do* re-create it, >poorly. > >I still don't think it's the right answer for Mr. Kshepitzki. >Pyro might be perfect. My own instinct is to start even more >primitively, with

Re: Importing a class without knowing the module

2005-11-18 Thread Franck PEREZ
On 11/18/05, Mike Meyer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > Mike Meyer <[EMAIL PROTECTED]> wrote: > >... > >> >> >> How about adding Foo.__file__ to the serialized data? > >... > >> >> depends on somewhere on it. You can use the module name if you have

mysql connection

2005-11-18 Thread Python_it
How can I close more cursors at the END of my page, after execute some scripts/functions. example: I use one DB connection and 5 cursor actions. How can I close these connections/actions at the END of my page? cursor.close() ==> 5 times?? db.close() -- http://mail.python.org/mailman/listinfo/

Re: Making a persistent HTTP connection

2005-11-18 Thread Piet van Oostrum
> "Alan Kennedy" <[EMAIL PROTECTED]> (AK) wrote: >AK> http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1 >AK> Some HTTP 1.0 clients supported persistent connections through the use >AK> of the non-standard "keep-alive" header. >>> And even if it works - what is the problem with con

Behaviour of enumerated types (was: Re: Immutable instances, constant values)

2005-11-18 Thread Ben Finney
Bengt Richter <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > >I've recently packaged 'enum' in PyPI. > [...] > My notion of enum comes from (what I remember of) Pascal You might want to investigate the 'enum' package for my idea of how an enumerated type can work. > which is

Re: Announce: PythonD 2.4.2 r 1.0 for DJGPP/DOS/Windows

2005-11-18 Thread Florian Xaver
Hi! I am very happy to hear this news! Thanks!! Bye, Flo -- Florian Xaver SWORD - a nice GUI library for DOS/DJGPP Unofficial Dr-DOS page -- http://mail.python.org/mailman/listinfo/python-list

Yield in a wrapper function

2005-11-18 Thread [EMAIL PROTECTED]
This works exactly as you would expect:: from time import sleep def foo(on='ABC'): for e in list(on): sleep(1) yield e When I run this on the command line It takes about 3 seconds to complete and the first letter is shown after 1 second. But, how do I wrap the function somew

Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
There is problaly a really simple answer to this, but why does this function print the correct result but return "None": def add(x, y): if x == 0: print y return y else: x -= 1 y += 1 add(x, y) print add(2, 4) result: 6 None Martin -- http://mai

Re: Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
any change you want to have : "return add(x,y)" in the else ? [EMAIL PROTECTED] wrote: > There is problaly a really simple answer to this, but why does this > function print the correct result but return "None": > > def add(x, y): > if x == 0: > print y > return y > else:

Python on linux

2005-11-18 Thread Amol Behl
Hi i wanted to know how can i find disk size on linux platform using python. Also any info on how i can partition the hard disk, etc will be welcome thank you. -- http://mail.python.org/mailman/listinfo/python-list

Choose meaningful subjects for posts [was: Re: newb ?]

2005-11-18 Thread Steve Holden
Fredrik Lundh wrote: > Chad Everett wrote: > > >>I am back. > > >>No I am not a high school or college student. > > > your subject lines still suck. please read this > > http://www.catb.org/~esr/faqs/smart-questions.html#bespecific > > before you post your next question. > > (the enti

Re: Adding through recursion

2005-11-18 Thread Mark Jackson
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > There is problaly a really simple answer to this, but why does this > function print the correct result but return "None": > > def add(x, y): > if x == 0: > print y > return y > else: > x -= 1 > y += 1 >

Re: Yield in a wrapper function

2005-11-18 Thread Peter Otten
[EMAIL PROTECTED] wrote: > from time import sleep > def foo(on): > for e in list(on): Just for e in on: #... is better. The list() constructor defeats much of the laziness you gain by using a generator. > sleep(1) > yield e > > def wrapper(x): > if x < 0: >

Re: Python on linux

2005-11-18 Thread Lars Kellogg-Stedman
> Hi i wanted to know how can i find disk size on linux platform using > python. You could use python to drive the 'sfdisk' command through a pipe, which will probably do much of what you want. -- Lars -- Lars Kellogg-Stedman <[EMAIL PROTECTED]> This email address will expire on 2005-11-23. --

Re: Adding through recursion

2005-11-18 Thread Peter Tillotson
basically the other two points :-) you create a string of add functions add(2,4)--add(1,5)--add(0,6) only in the last ( add(0,6) ) explicitly returns y, in the else of add(1,5) you ignor it. If you want the starting add to return something sensible you need to find a way to pass it back up the

Re: Adding through recursion

2005-11-18 Thread Simon Brunning
On 18 Nov 2005 05:22:47 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > There is problaly a really simple answer to this, but why does this > function print the correct result but return "None": > > def add(x, y): > if x == 0: > print y > return y > else: > x -

Re: Ajax for the Developers

2005-11-18 Thread Paul Boddie
SABIN wrote: > The trendy XML HTTP Request has really struck the way developers had adopted > with the user interfaces. But the major issuse are yet to be solved.. > > 1. Changing state with links (GET requests) > 2.Asynchronously performing batch operations > 3.Breaking the back button > > Will th

Re: Python on linux

2005-11-18 Thread John Abel
Here's one I used a while back. Returns a dict containing details per partition def _getAvailPartitions(): validTypes = [ 'ufs', 'nfs', 'reiserfs' ] mntTab = file( '/etc/mtab', 'r' ) drvDetails = {} for mntLine in mntTab: splitLine = mntLine.split()

Re: mysql connection

2005-11-18 Thread Steve Holden
Python_it wrote: > How can I close more cursors at the END of my page, > after execute some scripts/functions. > > example: > I use one DB connection and 5 cursor actions. > > How can I close these connections/actions at the END of my page? > > > cursor.close() ==> 5 times?? > db.close() > If

Re: Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
I still don't get it. I tried to test with x = 0 and found that to work. How come since the value of y is right and it is printed right it "turns into" None when returned by the return statement ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding through recursion

2005-11-18 Thread Simon Brunning
On 18 Nov 2005 06:30:58 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I still don't get it. I tried to test with x = 0 and found that to > work. How come since the value of y is right and it is printed right it > "turns into" None when returned by the return statement ? There is no return

Re: Adding through recursion

2005-11-18 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > I still don't get it. I tried to test with x = 0 and found that to > work. How come since the value of y is right and it is printed right it > "turns into" None when returned by the return statement ? Martin, -a function should either return something or not. Your f

Re: Reinvent no more forever

2005-11-18 Thread Dave Hansen
On 17 Nov 2005 18:06:55 -0800 in comp.lang.python, "Phillip J. Eby" <[EMAIL PROTECTED]> wrote: [...] > >Okay, so call yours "SuperEnum" or "PowerEnum" or "UltraEnum" or >"BetterEnum", "Enum-O-Matic", "Symbolitron"... ITYM "EnumOMatic" or "Enum_O_Matic". "Enum-O-Matic" is a syntax error. Or wors

combine doxygen and doc-strings?

2005-11-18 Thread Gabriel Zachmann
Is there a way to combine doxygen comments, like this one ## Documentation for a function. # @var a - variable # More details. def func( a ): pass with the doc strings, like this one def func( a ): """ Documentation for a function. More details. """ pass ? Ob

check if com api is still available

2005-11-18 Thread Hermann Maier
Hi, i am using the com api of a program and if this program is shut down and my program calls a method of the api, it crashs. that means, i need to check, if the com server is still available, before i can call for it. i already have a solution for this problem and it works quiet well, but i t

Re: different binding behavior

2005-11-18 Thread Gabriel Zachmann
> We've just had a HUGE thread arguing about this behaviour, just three or > five days ago. Let's not start it again. ok, could you please point me to it? > In a nutshell, the behaviour is because ints are immutable and can't be > changed in place, and lists are mutable and can be changed in plac

Re: Python obfuscation

2005-11-18 Thread Anton Vredegoor
Bengt Richter wrote: > On Thu, 17 Nov 2005 10:53:24 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote: > > >Anton Vredegoor <[EMAIL PROTECTED]> wrote: > [...] > >> The idea of using a webservice to hide essential secret parts of your > >> application can only work well if one makes some random altera

Re: Adding through recursion

2005-11-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I still don't get it. I tried to test with x = 0 and found that to > work. How come since the value of y is right and it is printed right it > "turns into" None when returned by the return statement ? because you're not returning the value to the print statement; you're

Newbie question. Pyexpat fails on make

2005-11-18 Thread Matt
Hi I want to build pyexpat and link it statically in Python. Im using Python 2.4.2. This is just a straight forward build using ./configure and then make I change *shared* to *static* and then uncoment these two lines: EXPAT_DIR=/usr/local/src/expat-1.95.2 pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EX

Re: combine doxygen and doc-strings?

2005-11-18 Thread Daniel Evers
You're maybe searching for epydoc: http://epydoc.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: GTK for windows and Linux

2005-11-18 Thread Daniel Crespo
I prefer wxPython www.wxpython.org Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question. Pyexpat fails on make

2005-11-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I want to build pyexpat and link it statically in Python. Im using > Python 2.4.2. This is just a straight forward build using ./configure > and then make > > I change *shared* to *static* and then uncoment these two lines: > > EXPAT_DIR=/usr/local/src/expat-1.95.2 > pye

Re: Python on linux

2005-11-18 Thread [EMAIL PROTECTED]
Partitioning a hard disk on linux can be done with parted, see http://www.gnu.org/software/parted/parted.html - I don't know how good the python-pated interface is, and what it's capable of -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML generation vs PSP vs Templating Engines

2005-11-18 Thread has
[EMAIL PROTECTED] wrote: > Could someone that has used all the different ways mentioned above for > dynamic HTML > content, suggest what the pros and cons of the different methods are? Not used them all - as you say, there's a plethora of options - but to give you a general idea of the territory.

How to convert a "long in a string" to a "long"?

2005-11-18 Thread ondekoza
Hello, I need to convert the string "" to a long. To convert this string I tried the following: >>> 0x -1 >>> 0xL 4294967295L OK, this is what I want, so I tried s = long("0xL") ValueError: invalid literal for long(): 0xL s = long("0x") ValueError

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Carsten Haese
On Fri, 2005-11-18 at 11:04, [EMAIL PROTECTED] wrote: > Hello, > > I need to convert the string "" to a long. To convert this > string I tried the following: > >>> 0x > -1 > >>> 0xL > 4294967295L > > OK, this is what I want, so I tried > > s = long("0xL") > ValueE

Re: Choose meaningful subjects for posts [was: Re: newb ?]

2005-11-18 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Fredrik Lundh wrote: >> Chad Everett wrote: >>>I am back. >>>No I am not a high school or college student. >> your subject lines still suck. please read this >> http://www.catb.org/~esr/faqs/smart-questions.html#bespecific >> before you post your next

cannot install numarray

2005-11-18 Thread Andi Petculescu
Hi, I'm trying to install numarray 1.4.1 on Darwin. When I run "python setup.py install", everything seems to work until an error message appears saying that there is no gcc. I installed gcc-4.0 from the X11 package that came with Mac OS-X. unable to execute gcc: No such file or directory>> error

Regular expressions and the global interpreter lock

2005-11-18 Thread Duncan Grisby
Hi, I have encountered a problem with the re module. I have a multi-threaded program that does lots of regular expression searching, with some relatively complex regular expressions. Occasionally, events can conspire to mean that the re search takes minutes. That's bad enough in and of itself, but

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Klaus Alexander Seistrup
Carsten Haese wrote: >> OK, this is what I want, so I tried >> >> s = long("0xL") >> ValueError: invalid literal for long(): 0xL >> >> s = long("0x") >> ValueError: invalid literal for long(): 0xL >> >> What can I do? >> >> Thank you in advance. >> Stefan > > L

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Steven Bethard
[EMAIL PROTECTED] wrote: 0xL > > 4294967295L > > OK, this is what I want, so I tried > > s = long("0xL") > ValueError: invalid literal for long(): 0xL >>> int("0x", 0) 4294967295L STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope vs Php

2005-11-18 Thread bruno at modulix
Steve wrote: > I am going to go the mod_python route. > > as for why a person would go route one over route 2 > > is that the number of lines of html/output vs python code are usually > 10 to 1 and it's much easier to encapsulate the python code than to > quote and escape all the html/css/xml >

Re: Zope vs Php

2005-11-18 Thread bruno at modulix
Mike Meyer wrote: > Jorge Godoy <[EMAIL PROTECTED]> writes: > >>Mike Meyer <[EMAIL PROTECTED]> writes: >> (snip) > > While I'm at it - how does KID do for things that aren't HTML? It doesn't. Kid is explicitely for XML/HTML templating. -- bruno desthuilliers python -c "print '@'.join(['.'.join

Re: Adding through recursion

2005-11-18 Thread Tim Williams (gmail)
On 18 Nov 2005 06:30:58 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:> I still don't get it. I tried to test with x = 0 and found that to Informative print statements can help you to see and understand  the program flow, especially if the problem is conceptual,  with no *real*  errors in yo

Re: Adding through recursion

2005-11-18 Thread Rocco Moretti
[EMAIL PROTECTED] wrote: > There is problaly a really simple answer to this, but why does this > function print the correct result but return "None": > > def add(x, y): > if x == 0: > print y > return y > else: > x -= 1 > y += 1 > add(x, y) > > prin

Speeding up multiple regex matches

2005-11-18 Thread Talin
I've run in to this problem a couple of times. Say I have a piece of text that I want to test against a large number of regular expressions, where a different action is taken based on which regex successfully matched. The naive approach is to loop through each regex, and stop when one succeeds. How

Re: Importing a class without knowing the module

2005-11-18 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > A classes __module__ attribute doesn't always tell you the name of the > module - or at least, not a name that would be usefull for the the OPs > use case. That's the case where you don't have the module name. The How do you arrange a module so that

Re: Python obfuscation

2005-11-18 Thread Alex Martelli
Anton Vredegoor <[EMAIL PROTECTED]> wrote: ... > What was mostly on my mind (but I didn't mention it) is that for > something to be commercially viable there should be some kind of > pricing strategy (NB in our current economic view of the world) where a > better paying user gets a vip interface

Re: sqlite utf8 encoding error

2005-11-18 Thread Greg Miller
Thank you for all your suggestions. I ended up casting the string to unicode prior to inserting into the database. Greg Miller -- http://mail.python.org/mailman/listinfo/python-list

Re: Speeding up multiple regex matches

2005-11-18 Thread Alex Martelli
Talin <[EMAIL PROTECTED]> wrote: ... > 1) Combine all of the regular expressions into one massive regex, and > let the regex state machine do all the discriminating. The problem with > this is that it gives you no way to determine which regex was the > matching one. Place each regex into a pare

Re: os.path.expanduser('~/foo') and MSWindows "My Documents"

2005-11-18 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > python > > >>> import os > >>> help(os.path.expanduser) > >>> import platform > >>> platform.system() > 'Windows' > >>> platform.release() > 'XP' > >>> platform looks good. ___

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Sion Arrowsmith
Steven Bethard <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> s = long("0xL") >> ValueError: invalid literal for long(): 0xL > >>> int("0x", 0) >4294967295L So why does the base argument to int() (or long()) default to 10 and not 0? -- \S -- [EMAIL PROTECTED] --

Los Angeles Python Users' Group, anyone?

2005-11-18 Thread mortenbagai
Hi, I was rifling through python.org to see if there was an existing Python user's group for the Los Angeles area. Doesn't seem like it, so maybe we should start one? I'm interested in helping with the coordination of activities etc. Since everybody living in greater L.A. area is likely to have s

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Leif K-Brooks
Sion Arrowsmith wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] wrote: >> >>>s = long("0xL") >>>ValueError: invalid literal for long(): 0xL >>> >int("0x", 0) >> >>4294967295L > > So why does the base argument to int() (or long()) default to >

Re: Python obfuscation

2005-11-18 Thread Bengt Richter
On 18 Nov 2005 06:56:38 -0800, "Anton Vredegoor" <[EMAIL PROTECTED]> wrote: [...] >Pardon me, but I'm Anton, not Antoon (well maybe I am but lets keep >this distinction in order to avoid mental hash collisions) D'oh. I'm sorry. Please pardon _me_ ;-/ Regards, Bengt Richter -- http://mail.python.o

Re: Reinvent no more forever

2005-11-18 Thread Phillip J. Eby
Dave Hansen wrote: > On 17 Nov 2005 18:06:55 -0800 in comp.lang.python, "Phillip J. Eby" > <[EMAIL PROTECTED]> wrote: > > [...] > > > >Okay, so call yours "SuperEnum" or "PowerEnum" or "UltraEnum" or > >"BetterEnum", "Enum-O-Matic", "Symbolitron"... > > ITYM "EnumOMatic" or "Enum_O_Matic". "Enum-O

BisonGen parser generator. Newbie question

2005-11-18 Thread ishtar2020
Hello everybody! I'm trying to run the calculator example included with the "BisonGen" parser generator, but I've been unable to put it to work. When I compile the xml file "simple.bgen" with the script "BisonGen.bat", the only parser I get is a C file. I've heard BisonGen generates also a python

Re: Python obfuscation

2005-11-18 Thread Serge Orlov
Ben Sizer wrote: > Mike Meyer wrote: > > "Ben Sizer" <[EMAIL PROTECTED]> writes: > > > Decompyle (http://www.crazy-compilers.com/decompyle/ ) claims to be > > > pretty advanced. I don't know if you can download it any more to test > > > this claim though. > > > > No, it doesn't claim to be advanced

examining python objects

2005-11-18 Thread rurpy
Is there a function/class/module/whatever I can use to look at objects? I want something that will print the object's value (if any) in pretty-printed form, and list all it's attributes and their values. And do all that recursively. I want to be able to find out everything about an object that Py

the PHP ternary operator equivalent on Python

2005-11-18 Thread Daniel Crespo
Hi! I would like to know how can I do the PHP ternary operator/statement (... ? ... : ...) in Python... I want to something like: a = {'Huge': (quantity>90) ? True : False} Any suggestions? Thanks Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Simon Brunning
On 18 Nov 2005 10:53:04 -0800, Daniel Crespo <[EMAIL PROTECTED]> wrote: > I would like to know how can I do the PHP ternary operator/statement > (... ? ... : ...) in Python... Wait for Python 2.5 - . -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunn

How to do "new_variable = (variable) ? True : False; " (php) on python?

2005-11-18 Thread Daniel Crespo
Hello to all, How can I do new_variable = (variable) ? True : False; in Python in one line? I want to do something like this: dic = {'item1': (variable) ? True-part : False-part} Any suggestions? Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> A classes __module__ attribute doesn't always tell you the name of the >> module - or at least, not a name that would be usefull for the the OPs >> use case. That's the case where you don't have the module

SnakeCard on sourceforge

2005-11-18 Thread Philippe C. Martin
Dear all, The SnakeCard product line is now hosted on sourceforge.net: SCFB - http://sourceforge.net/projects/sctoolkits SC-ID - http://sourceforge.net/projects/sc-id I will keep posting the snapshots on www.snakecard.com as well as SCLOGON and SCWEB until they take shape ;-) Regards, Philip

Re: path module / class

2005-11-18 Thread [EMAIL PROTECTED]
Hi Neil, Neil Hodgson wrote: [snip] > There is no PEP yet but there is a wiki page. > http://wiki.python.org/moin/PathClass > Guido was unenthusiastic so a good step would be to produce some > compelling examples. I guess it depends on what is "compelling" :) I've been trying to come up

Re: How to do "new_variable = (variable) ? True : False; " (php) on python?

2005-11-18 Thread Peter Otten
Daniel Crespo wrote: > How can I do > > new_variable = (variable) ? True : False; > > in Python in one line? new_variable = variable :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Web-based client code execution

2005-11-18 Thread Paul Watson
What are the options? The user to hits a web page, downloads code (Python I hope), execute it, and be able to return the results. It needs to be able to go through standard HTTP so that it could be run from behind a corporate firewall without any other ports being opened. Am I stuck doing an

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread David Wahler
Daniel Crespo wrote: > I would like to know how can I do the PHP ternary operator/statement > (... ? ... : ...) in Python... > > I want to something like: > > a = {'Huge': (quantity>90) ? True : False} Well, in your example the '>' operator already returns a boolean value so you can just use it di

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Mike Meyer
"Daniel Crespo" <[EMAIL PROTECTED]> writes: > Hi! > > I would like to know how can I do the PHP ternary operator/statement > (... ? ... : ...) in Python... > > I want to something like: > > a = {'Huge': (quantity>90) ? True : False} > > Any suggestions? Lots of ways, depending on your exact needs

Re: Python on linux

2005-11-18 Thread Sybren Stuvel
John Abel enlightened us with: > Here's one I used a while back. Returns a dict containing details per > partition This only gives information about actually mounted partitions. It could be improved by checking /proc/partitions as well. Sybren -- The problem with the world is stupidity. Not sa

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread gene tani
Mike Meyer wrote: > "Daniel Crespo" <[EMAIL PROTECTED]> writes: > > > Hi! > > > > I would like to know how can I do the PHP ternary operator/statement > > (... ? ... : ...) in Python... > > > > I want to something like: > > > > a = {'Huge': (quantity>90) ? True : False} > > > > Any suggestions? >

Controlling windows gui applications from python

2005-11-18 Thread tim
Hi all, I'm almost as new to this list as to python so I hope I don't get a "this has been answered a 100 times before" or anything... Currently I am using a program named 'Macro Scheduler' for automating programs that don't have a command line version. Its a simple scripting language that allow

Re: Choose meaningful subjects for posts [was: Re: newb ?]

2005-11-18 Thread Grant Edwards
On 2005-11-18, Mike Meyer <[EMAIL PROTECTED]> wrote: >>> http://www.catb.org/~esr/faqs/smart-questions.html#bespecific >>> before you post your next question. If I can't tell from the subject line what the thread is about, I almost never read it. >> Note also that the subject line on an exis

Re: Web-based client code execution

2005-11-18 Thread Steve
AJAX works because browsers can execute javascript. I don't know of a browser that can execute python. Basically your stuck with java or javascript because everything else really isn't cross platform. -- http://mail.python.org/mailman/listinfo/python-list

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Daniel Crespo
Oh... Well, thanks for that information. I'll do this then: def TernaryOperation(condition,true_part,false_part): if condition: return True-part else: return False-part a = {'Huge': TernaryOperation(quantity>90,True,False)} Thank you -- http://mail.python.org/mailman/l

Re: How to do "new_variable = (variable) ? True : False; " (php) on python?

2005-11-18 Thread Sam Pointon
Daniel Crespo wrote: > Hello to all, > > How can I do > > new_variable = (variable) ? True : False; > > in Python in one line? > > I want to do something like this: > > dic = {'item1': (variable) ? True-part : False-part} > > Any suggestions? > > Daniel There's a trick using the short-circuiting b

Re: Controlling windows gui applications from python

2005-11-18 Thread Simon Brunning
On 18/11/05, tim <[EMAIL PROTECTED]> wrote: > Hi all, I'm almost as new to this list as to python so I hope I don't > get a "this has been answered a 100 times before" or anything... > > Currently I am using a program named 'Macro Scheduler' for automating > programs that don't have a command line

Re: Controlling windows gui applications from python

2005-11-18 Thread Paul Watson
tim wrote: > Hi all, I'm almost as new to this list as to python so I hope I don't > get a "this has been answered a 100 times before" or anything... > > Currently I am using a program named 'Macro Scheduler' for automating > programs that don't have a command line version. > Its a simple script

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Peter Otten
Daniel Crespo wrote: > Oh... Well, thanks for that information. > > I'll do this then: > > def TernaryOperation(condition,true_part,false_part): > if condition: > return True-part > else: > return False-part > > a = {'Huge': TernaryOperation(quantity>90,True,False)} By

Re: Web-based client code execution

2005-11-18 Thread Paul Watson
Steve wrote: > AJAX works because browsers can execute javascript. I don't know of a > browser that can execute python. Basically your stuck with java or > javascript because everything else really isn't cross platform. Well, I guess the Grail browser could run Python, but I do not think I can

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Grant Edwards
On 2005-11-18, Daniel Crespo <[EMAIL PROTECTED]> wrote: > I would like to know how can I do the PHP ternary operator/statement > (... ? ... : ...) in Python... The _PHP_ ternary operator (x?y:z)! Kids these days! -- Grant Edwards grante Yow! It's so OBVIOUS!!

Re: Web-based client code execution

2005-11-18 Thread Steve
You universally won't be able to do that with javascript, only with and extension on firefox. ActiveX will limit you to windows only with ie. Which isn't bad you still get a 80% market share. -- http://mail.python.org/mailman/listinfo/python-list

Re: Choose meaningful subjects for posts [was: Re: newb ?]

2005-11-18 Thread skip
Grant> Obligatory aside: I'm completely baffled why anybody would choose Grant> the mailing list format over Usenet. I don't even read mailing Grant> lists via mailing lists. I recommend gmane.org's NNTP server for Grant> all your mailing list needs. For the same reason I don't

Type-checking unpickled objects

2005-11-18 Thread Gordon Airporte
I have this class, and I've been pickling it's objects as a file format for my program, which works great. The problems are a.) how to handle things when the user tries to load a non-pickled file, and b.) when they load a pickled file of the wrong class. a. I can handle with a general exception

Re: Yield in a wrapper function

2005-11-18 Thread Bengt Richter
On 18 Nov 2005 05:08:39 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >This works exactly as you would expect:: > > from time import sleep > def foo(on='ABC'): >for e in list(on): >sleep(1) >yield e > >When I run this on the command line It takes about 3 seconds to >com

  1   2   >