Re: pickle alternative

2005-06-19 Thread simonwittber
I think you should implement it as a C extension and/or write a PEP. This has been an unfilled need in Python for a while (SF RFE 467384). I've submitted a proto PEP to python-dev. It coming up against many of the same objections to the RFE. Sw. --

Re: pickle alternative

2005-06-19 Thread Paul Rubin
[EMAIL PROTECTED] writes: I think you should implement it as a C extension and/or write a PEP. This has been an unfilled need in Python for a while (SF RFE 467384). I've submitted a proto PEP to python-dev. It coming up against many of the same objections to the RFE. See also bug# 471893

Re: Help implementing an idea

2005-06-19 Thread Tim Roberts
[EMAIL PROTECTED] wrote: Well, I'm a total python n00b, but I was playing around with exception handling yesterday, and was stricken by how incredibly easy it is to use the op system to create nice scripts... I did the following: import sys lines = sys.stdin.readlines() lines.sort() for stuff

Embedding Python - How to create a class instance

2005-06-19 Thread Miki Tebeka
Hello All, I'm trying to embed Python in a C application. What I didn't find is how to create an instance once I have a class object. I'd like to do the equivalent of: from a import A obj = A() obj.foo(10) The following code omits error checking for clarity. --- a.py --- class A:

Re: pickle alternative

2005-06-19 Thread simonwittber
See also bug# 471893 where jhylton suggests a PEP. Something really ought to be done about this. I know this, you know this... I don't understand why the suggestion is meeting so much resistance. This is something I needed for a real world system which moves lots of data around to untrusted

Re: What platforms have Python Virtual Machines and what version(s) ofPython do they support?

2005-06-19 Thread Terry Reedy
Casey Hawthorne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What platforms have Python Virtual Machines and what version(s) of Python do they support? In particular: Palm OS PocketPC Try using Google (Python PocketPC, for instance) or the equivalent TJR --

Re: What platforms have Python Virtual Machines and what version(s) ofPython do they support?

2005-06-19 Thread gene tani
http://dmoz.org/Computers/Programming/Languages/Python/Ports/ -- http://mail.python.org/mailman/listinfo/python-list

Re: regarding popen function

2005-06-19 Thread Michael Hoffman
Peter Hansen wrote: Michael, tai64nlocal is a program that converts a special packed timestamp to human-readable form. Thanks Peter. I was asking somewhat rhetorically but I have a love of UNIX arcana and now I know. :) -- Michael Hoffman --

Re: Why is there no instancemethod builtin?

2005-06-19 Thread Michael Hoffman
John Roth wrote: you need _both_ isinstance and the types module to do a correct check for any string type: isinstance(fubar, types.StringTypes). That's because both string and unicode are subtypes of one base. But basestring, their base class is a built-in. -- Michael Hoffman --

Re: Help implementing an idea

2005-06-19 Thread gene tani
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299271 or the nice recipe, page 403 of cookbook2, that i can't find in ASPN -- http://mail.python.org/mailman/listinfo/python-list

Re: Help implementing an idea

2005-06-19 Thread Fuzzyman
[EMAIL PROTECTED] wrote: [snip..] results. Now, I was thinking today, I'd really like to create a program that can go to a specific directory and upload all the files in the directory to a specific url for backup purposes, and I have the feeling that the python implementation would be

Re: oddness in super()

2005-06-19 Thread Björn Lindström
Martin Blume [EMAIL PROTECTED] writes: A great analysis, but what's a pogo stick and where can I get one? http://search.ebay.com/pogo-stick -- Bjrn Lindstrm [EMAIL PROTECTED] Student of computational linguistics, Uppsala University, Sweden --

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread Roy Smith
[EMAIL PROTECTED], Bo Peng [EMAIL PROTECTED] wrote: I have around 10 of them. Using these if/else, it will take 50 lines for a function call. It also bothers me to have 10 variables left in the namespace, in addition to finding 10 meaningful names. If you've got 10 different conditional

Re: oddness in super()

2005-06-19 Thread Martin Blume
Bjrn Lindstrm schrieb A great analysis, but what's a pogo stick and where can I get one? http://search.ebay.com/pogo-stick Yes, that explains the bouncing with the pogo stick; I would have poked around with a stick. ROTFL, thank you. Martin --

Re: What platforms have Python Virtual Machines and what version(s) ofPython do they support?

2005-06-19 Thread Fuzzyman
Hmmm... the page is a *bit* out of date (which is to be expected I suppose). There is a port of Python 2.3 for Pocket PC. I think pippy is pretty dead and wasn't that useable. On this newsgroup not long ago someone announced they were working on a new PalmOS port. To the best of my knowledge

Re: pickle alternative

2005-06-19 Thread simonwittber
If anyone is interested, I've implemented a faster and more space efficient gherkin with a few bug fixes. http://developer.berlios.de/project/showfiles.php?group_id=2847 -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread gene tani
If your test variable has specific values to branch on, the standard way is to have those values be keys in a dictionary, and do: branched_func_obj = dict_of_values.get(testvar) And the lambda hack is here, courtesy of Peter Norvig http://www.norvig.com/python-iaq.html --

Re: Why is there no instancemethod builtin?

2005-06-19 Thread Michele Simionato
In this case I have used hasattr(obj, __iter__) instead of isinstance(obj, list) (strings are iterable but do not have __iter__ method). I think hasattr is much better since it works for tuples and custom iterables too. Michele Simionato --

Re: Migrating from Windows to OS X

2005-06-19 Thread Dave Cook
On 2005-06-18, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How are the development tools for the Mac? I'll use IDLE if it's available, but I like Scintilla better. Idle is /System/Library/Frameworks/Python.framework/Versions/2.3/bin/idle First thing you want to do is install readline to make

Re: pysqlite - Checking the existance of a table

2005-06-19 Thread Dave Cook
On 2005-06-17, rh0dium [EMAIL PROTECTED] wrote: I am starting to play with pysqlite, and would like to know if there is a function to determine if a table exists or not. sqlite_master has already been mentioned, so I'll point out some useful pragmas (under Pragmas to query the database

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread Bo Peng
Roy Smith wrote: Can you give us some idea of what it is that you're trying to do? It pretty unusual to see a requirement like that. def func(type_of_obj1, type_of_obj2, .): callfunc( [ type_of_obj1 and obj1a() or obj1b(), type_of_obj2 and obj2a() or obj2b(),

Re: extreme newbie

2005-06-19 Thread Dave Cook
On 2005-06-18, cpunerd4 [EMAIL PROTECTED] wrote: thanks all for the advice. The reason I was thinking about using java (or C or something) was that it is a little more secure than distributing the source code isn't it? sigh 14 and he already wants to horde his source code. Dave Cook --

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread Roy Smith
In article [EMAIL PROTECTED], Bo Peng [EMAIL PROTECTED] wrote: Roy Smith wrote: Can you give us some idea of what it is that you're trying to do? It pretty unusual to see a requirement like that. def func(type_of_obj1, type_of_obj2, .): callfunc( [ type_of_obj1 and

Re: Shortcut to initialize variables

2005-06-19 Thread Leif K-Brooks
Kent Johnson wrote: letters = {} for letter in ascii_lowercase: letters[letter] = 0 Or more simply: letters = dict.fromkeys(ascii_lowercase, 0) -- http://mail.python.org/mailman/listinfo/python-list

Re: extreme newbie

2005-06-19 Thread Dave Cook
On 2005-06-18, cpunerd4 [EMAIL PROTECTED] wrote: I see your point, although I don't think there is much a 14 year old can do to sue someone. . . I'm sure my code won't be that valuable untill I'm older though. Thanks It's valuable as something to show prospective employers or clients: I wrote

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread George Sakkis
Bo Peng wrote: Roy Smith wrote: Can you give us some idea of what it is that you're trying to do? It pretty unusual to see a requirement like that. def func(type_of_obj1, type_of_obj2, .): callfunc( [ type_of_obj1 and obj1a() or obj1b(), type_of_obj2 and obj2a() or

Re: extreme newbie

2005-06-19 Thread Peter Hansen
Dave Cook wrote: On 2005-06-18, cpunerd4 [EMAIL PROTECTED] wrote: thanks all for the advice. The reason I was thinking about using java (or C or something) was that it is a little more secure than distributing the source code isn't it? sigh 14 and he already wants to horde his source code.

Re: Why is there no instancemethod builtin?

2005-06-19 Thread George Sakkis
Michele Simionato wrote: In this case I have used hasattr(obj, __iter__) instead of isinstance(obj, list) (strings are iterable but do not have __iter__ method). I think hasattr is much better since it works for tuples and custom iterables too. The fact that strings don't have __iter__ is

Re: New WYSIWYG Python IDE in the works

2005-06-19 Thread Florian Diesch
McBooCzech [EMAIL PROTECTED] wrote: sorry for bothering you with my comment. From my point of view, the situation on the IDE (GUI??) development field for Python is really strange. Just try to imagine the same situation around the Python. Plenty of different approaches, versions, philosophies

Re: Why is there no instancemethod builtin?

2005-06-19 Thread Michele Simionato
I think strings do not have __iter__ on purpose, exactly to distinguish them from other iterables, since sometimes it is nice to consider them atomic, but I am not sure of this. You should ask the developers. Anyway, the right definition of iterable is (as I was told) an object X such that iter(X)

Re: Why is there no instancemethod builtin?

2005-06-19 Thread George Sakkis
Michele Simionato wrote: I think strings do not have __iter__ on purpose, exactly to distinguish them from other iterables, since sometimes it is nice to consider them atomic, but I am not sure of this. You should ask the developers. Anyway, the right definition of iterable is (as I was told)

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread Ron Adam
Bo Peng wrote: Roy Smith wrote: Can you give us some idea of what it is that you're trying to do? It pretty unusual to see a requirement like that. def func(type_of_obj1, type_of_obj2, .): callfunc( [ type_of_obj1 and obj1a() or obj1b(), type_of_obj2 and obj2a() or

tab 2 into tab 4 ?

2005-06-19 Thread [EMAIL PROTECTED]
Hello, I have python code which use tab=2. Recently I would like to change it into tab=4. Anyone has suggestion to convert easily and safely ? pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no instancemethod builtin?

2005-06-19 Thread John Roth
George Sakkis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Michele Simionato wrote: I think strings do not have __iter__ on purpose, exactly to distinguish them from other iterables, since sometimes it is nice to consider them atomic, but I am not sure of this. You should ask the

Re: Why is there no instancemethod builtin?

2005-06-19 Thread George Sakkis
John Roth wrote: Unfortunately it doesn't work: getitem can be defined for a class that acts like a dictionary: that is, the items are not integers, let alone integers that extend in a strict sequence from 0. This is true, but that's the current behaviour of iterators for classes that define

Re: tab 2 into tab 4 ?

2005-06-19 Thread vincent wehren
[EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] | Hello, | | I have python code which use tab=2. Recently I would like to change it | into tab=4. | | Anyone has suggestion to convert easily and safely ? Look at reindent.py in Tools\Scripts. -- Vincent Wehren | | pujo | --

Re: What platforms have Python Virtual Machines and what version(s) ofPython do they support?

2005-06-19 Thread Kent Johnson
Fuzzyman wrote: To the best of my knowledge jython is languishing at Python 2.1. The PSF has funded a push to implement new style classes which will allow it to be brought up to date. It's really not languishing any more. There is a lot of activity spearheaded by Brian Zimmer (who received

Re: pickle alternative

2005-06-19 Thread Paul Rubin
[EMAIL PROTECTED] writes: See also bug# 471893 where jhylton suggests a PEP. Something really ought to be done about this. I know this, you know this... I don't understand why the suggestion is meeting so much resistance. This is something I needed for a real world system which moves

calling subclass constructor question

2005-06-19 Thread In Han Kang
Hello everyone and thank you for being such a good community. Anyway, I was wondering...I have an super class which is the superclass for 5 other classes. However, I want to be able to call the subclass constructors from the super class. Is this possible? Thank you in advance --

Re: tab 2 into tab 4 ?

2005-06-19 Thread [EMAIL PROTECTED]
Thanks it works! pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: calling subclass constructor question

2005-06-19 Thread Diez B. Roggisch
In Han Kang wrote: Hello everyone and thank you for being such a good community. Anyway, I was wondering...I have an super class which is the superclass for 5 other classes. However, I want to be able to call the subclass constructors from the super class. Is this possible? If you have

Re: functions with unlimeted variable arguments...

2005-06-19 Thread Xah Lee
oops... it is in the tutorial... sorry. though, where would one find it in the python reference? i.e. the function def with variable/default parameters. This is not a rhetorical question, but where would one start to look for it in the python ref? a language is used by programers. Subroutine

Re: pickle alternative

2005-06-19 Thread Paul Rubin
[EMAIL PROTECTED] writes: If anyone is interested, I've implemented a faster and more space efficient gherkin with a few bug fixes. It would be nice if you just posted the PEP. -- http://mail.python.org/mailman/listinfo/python-list

Re: calling subclass constructor question

2005-06-19 Thread [EMAIL PROTECTED]
No. You will go into an infinite loop - at least I get there when I try someting like this: class Base: def __init__(self): Derived.__init__(self) print 'Base' class Derived(Base): def __init__(self): Base.__init__(self)

Re: functions with unlimeted variable arguments...

2005-06-19 Thread Robert Kern
Xah Lee wrote: oops... it is in the tutorial... sorry. though, where would one find it in the python reference? i.e. the function def with variable/default parameters. This is not a rhetorical question, but where would one start to look for it in the python ref? Oddly enough,

references/addrresses in imperative languages

2005-06-19 Thread Xah Lee
in coding Python yesterday, i was quite stung by the fact that lists appened to another list goes by as some so-called reference. e.g. t=range(5) n=range(3) n[0]='m' t.append(n) n[0]='h' t.append(n) print t in the following code, after some 1 hour, finally i found the solution of h[:]. (and

Re: functions with unlimeted variable arguments...

2005-06-19 Thread Diez B. Roggisch
Xah Lee wrote: oops... it is in the tutorial... sorry. though, where would one find it in the python reference? i.e. the function def with variable/default parameters. This is not a rhetorical question, but where would one start to look for it in the python ref? a language is used by

Re: references/addrresses in imperative languages

2005-06-19 Thread Diez B. Roggisch
In hindsight analysis, such language behavior forces the programer to fuse mathematical or algorithmic ideas with implementation details. A easy way to see this, is to ask yourself: how come in mathematics there's no such thing as addresses/pointers/references. Mathematics also has no

Re: calling subclass constructor question

2005-06-19 Thread Steven Bethard
In Han Kang wrote: Anyway, I was wondering...I have an super class which is the superclass for 5 other classes. However, I want to be able to call the subclass constructors from the super class. Is this possible? Are you trying to use your superclass as a factory? If so, one option is

calling subclass constructor question

2005-06-19 Thread In Han Kang
So each of the sub classes plots a different type of graph. The superclass defines methods that are the same for all the plots. I want to be able to pick some points and be able to generate a more plots. What I was wondering if I could define in a method in the superclass of an object the

RE: functions with unlimited variable arguments...

2005-06-19 Thread Chinook
Xah said unto the world: oops... it is in the tutorial... sorry. though, where would one find it in the python reference? i.e. the function def with variable/default parameters. This is not a rhetorical question, but where would one start to look for it in the python ref? a language is used by

Re: What is different with Python ?

2005-06-19 Thread D H
Peter Hansen wrote: D H wrote: So you say he has done relatively little serious development and that he may not even know about Python. I didn't see any evidence from those pages to draw either conclusion. In fact the 4th paragraph quite contradicts them both. Clearly this is a

login website that using PHP

2005-06-19 Thread frost
Hi, I am trying to login a website that using PHP and javascript. This is what happend if you browse that website using IE, after you login, you can go anywhere without enter your name and password again, as long as you keep that IE open, but after you close that IE, then later on open that

Re: case/switch statement?

2005-06-19 Thread D H
Peter Hansen wrote: D H wrote: Peter Hansen wrote: [some stuff Doug didn't like] Actually, this is what you snipped, stuff you didn't like, because the very mention of boo causes you such fits: Since you and Steve Holden agree that a case statement is useful, why don't you propose

Re: Is there something similar to ?: operator (C/C++) in Python?

2005-06-19 Thread D H
Peter Hansen wrote: Bo Peng wrote: I need to pass a bunch of parameters conditionally. In C/C++, I can do func(cond1?a:b,cond2?c:d,.) Is there an easier way to do this in Python? Please read the FAQ to learn the answer and much other useful ... The answer is no. Use if

Re: Loop until condition is true

2005-06-19 Thread D H
Joseph Garvin wrote: Peter Otten wrote: I found 136 occurrences of do { versus 754 of while ( and 1224 of for ( in the Python 2.4 source, so using these rough estimates do-while still qualifies as rarely used. Peter That's 136 times you'd have to use an ugly hack instead. I

Re: Using swig to use an existing dll/library

2005-06-19 Thread Chris Lambacher
You should be able to access regular dlls and handle callbacks with the ctypes module without needing to resort to any real c code: http://starship.python.net/crew/theller/ctypes/ -Chris On 18 Jun 2005 02:10:59 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi together, i have a Windows

Re: calling subclass constructor question

2005-06-19 Thread D H
In Han Kang wrote: So each of the sub classes plots a different type of graph. The superclass defines methods that are the same for all the plots. I want to be able to pick some points and be able to generate a more plots. What I was wondering if I could define in a method in the

Re: Extensions on Linux: import without underscore?

2005-06-19 Thread Terry Hancock
On Saturday 18 June 2005 10:35 pm, James Carroll wrote: Hi, I'm creating an extension called _bright.so on linux. I can import it with import _bright, but how can I import bright and get the package? On windows, I've been able to import bright instead of import _bright, but on Linux it

Re: references/addrresses in imperative languages

2005-06-19 Thread Jeremy Jones
I think the only reason I read your posts is for comedy, seeing if this is yet another Xah Lee just threw a tantrum post. I don't know why I'm wasting my time responding, though... It's against my better judgment and my previous advice to the group. Xah Lee wrote: in coding Python

Re: references/addrresses in imperative languages

2005-06-19 Thread Terry Hancock
On Sunday 19 June 2005 05:34 pm, Xah Lee wrote: in coding Python yesterday, i was quite stung by the fact that lists appened to another list goes by as some so-called reference. e.g. t=range(5) n=range(3) n[0]='m' t.append(n) n[0]='h' t.append(n) print t Day one in learning Python, yes

Using print with format to stdout generates unwanted space

2005-06-19 Thread Paul Watson
#!/usr/bin/env python # Using a print statement to stdout results in an # unwanted space character being generated at the # end of each print output. Same results on # DOS/Windows and AIX. # # I need precise control over the bytes that are # produced. Why is print doing this? #

Re: static data descriptors and possibly spurious calls to __set__?

2005-06-19 Thread Michele Simionato
...it's this last one that causes the problem. In the real code, the call to type.__setattr__ referred to above seems to lead to a call to something like cls.__base__.__dict__[attr].__set__(cls, value). Uhm ... sounds right, but I a bit confused. Could you please give us a doctest showing us what

Re: Using print with format to stdout generates unwanted space

2005-06-19 Thread John Roth
Don't use print, write directly to sys.stdout. Print is not intended for precise output formatting; it's intended for quick outputs that are useable most of the time. John Roth Paul Watson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] #!/usr/bin/env python # Using a print

Re: New WYSIWYG Python IDE in the works

2005-06-19 Thread dcrespo
wxDesigner + XRCed = The best. I would like the Boa approach but with xrc exports. It would reaally be the best of the best! And don't get me wrong too, but to be better than the competition you need to be better than the competition - Christoph Rackwitz Daniel --

Re: case/switch statement?

2005-06-19 Thread Andrew Durdin
On 6/18/05, D H [EMAIL PROTECTED] wrote: I would hardly call using a dictionary as a switch statement, the equivalent. The fact that people use a dictionary as a conditional is a python wart. Not at all. A case statement is nothing more than a literal mapping of constant values to the

Re: references/addrresses in imperative languages

2005-06-19 Thread Lawrence DâOliveiro
In article [EMAIL PROTECTED], Xah Lee [EMAIL PROTECTED] wrote: A[n] easy way to see this, is to ask yourself: how come in mathematics there's no such thing as addresses/pointers/references. Yes there are such things in mathematics, though not necessarily under that name. For instance, in