Python & LEGO Mindstorm control...

2008-12-08 Thread feinepost
Hi Toni Meyer, I would be quite interested in your Python extension to send ir signals to the rcx. I am quite new to this stuff, hope I'll understand what you did? Could you send it to me? Thanks a lot! Daniel Rupp -- http://mail.python.org/mailman/listinfo/python-list

html codes

2008-12-08 Thread Daniel Fetchinson
Hi folks, I came across a javascript library that returns all sorts of html codes in the cookies it sets and I need my web framework (written in python :)) to decode them. I'm aware of htmlentitydefs but htmlentitydefs.entitydefs.keys( ) are of the form '&#xxx' but this javascript library uses stu

SequenceMatcher bug ?

2008-12-08 Thread eliben
Hello, This is about Python 2.5.2 - I don't know if there were fixes to this module in 2.6/3.0 I think I ran into a bug with difflib.SequenceMatcher class. Specifically, its ratio() method. The following: SequenceMatcher(None, [4] + [10] * 500 + [5], [10] * 500 + [5]).ratio () returns 0.0 Whil

Re: Guido's new method definition idea

2008-12-08 Thread Alex_Gaynor
I'm a huge -1 on this, it adds nothing to the language, and IMO violates quite a few Zens. -Beautiful is better than ugly. A bit subjective, but this is ugly IMO. -Special cases aren't special enough to break the rules. -There should be one-- and preferably only one --obvious way to do it. -- http

Re: "as" keyword woes

2008-12-08 Thread Gabriel Genellina
En Mon, 08 Dec 2008 18:07:22 -0200, J. Cliff Dyer <[EMAIL PROTECTED]> escribió: On Wed, 2008-12-03 at 21:42 -0800, Warren DeLano wrote: Anyway, it seems obvious that the right decision for our customers (or more importantly, for their countless lines of autogenerated-Python log, state, and code

Re: [Python 2.x] Pickling a datetime.tzinfo subclass instance?

2008-12-08 Thread Gabriel Genellina
En Mon, 08 Dec 2008 12:34:03 -0200, Cong Ma <[EMAIL PROTECTED]> escribió: I'm writing a program that pickles an instance of a custom subclass of datetime.tzinfo. I followed the guides given in the Library Reference (version 2.5.2, chapter 5.1.6), which contain the note: "Special requirement

Re: how to get a beep, OS independent ?

2008-12-08 Thread greg
Duncan Booth wrote: If I'm logged in to one of my servers in a large datacentre then I don't what that system to beep as that would be pretty useless. It also might cause the datacentre operators some consternation when one of their servers starts mysteriously beeping... -- Greg -- http://mail

Re: Guido's new method definition idea

2008-12-08 Thread greg
[EMAIL PROTECTED] wrote: On another related note, I would be interested in seeing this syntax adopted for a different purpose... class C: def createfunc(self): def self.func(arg): return arg + 1 I agree -- this would be a much better use of the syntax, and I'd like to

Re: Catching Python exceptions in C

2008-12-08 Thread Gabriel Genellina
En Mon, 08 Dec 2008 16:42:30 -0200, Senthil Kumar <[EMAIL PROTECTED]> escribió: I am trying to raise exceptions in python and trying to handle it in C. I am able to raise exceptions successfully. However could not catch those in C. I am using the following function to run the python from C: Pyru

Re: close has no effect on Mac OSX Python 3.0

2008-12-08 Thread Gabriel Genellina
En Mon, 08 Dec 2008 20:09:23 -0200, resi147 <[EMAIL PROTECTED]> escribió: I'm wondering if it's really a bug since it's so trivial: fp = open('/etc/services') ct = fp.read(1048) print(ct[-80:], end='') fp.close() ct = fp.read(17) print(ct) the second read should fail, b

Re: fuzzy or boolean text search

2008-12-08 Thread John Machin
On Dec 9, 4:36 pm, n00b <[EMAIL PROTECTED]> wrote: > hi, > > i'm looking for advice/suggestions for text search, preferably with > boolean or even fuzzy capabilities, and for use with mysql innodb > tables.  asking too much :) ??? No ... feeding "fuzzy boolean text search mysql innodb" to my googl

Re: Password input in console/terminal

2008-12-08 Thread Chris Rebert
On Mon, Dec 8, 2008 at 9:53 PM, RP <[EMAIL PROTECTED]> wrote: > Hello All, > > This is my first REAL post(question) to Python-List. I know I can take input > from a user with raw_input() > How do I take password input in console? Any Help would be Greatly > Appreciated. Thank You. RP You use the a

Password input in console/terminal

2008-12-08 Thread RP
Hello All, This is my first REAL post(question) to Python-List. I know I can take input from a user with raw_input() How do I take password input in console? Any Help would be Greatly Appreciated. Thank You. RP -- http://mail.python.org/mailman/listinfo/python-list

Re: How to initialize a class variable once

2008-12-08 Thread Roy Smith
In article <[EMAIL PROTECTED]>, alex23 <[EMAIL PROTECTED]> wrote: > You might need to provide some more details about your code. It's going to take me some time to generate a minimal test case. -- http://mail.python.org/mailman/listinfo/python-list

fuzzy or boolean text search

2008-12-08 Thread n00b
hi, i'm looking for advice/suggestions for text search, preferably with boolean or even fuzzy capabilities, and for use with mysql innodb tables. asking too much :) ??? thx a bunch -- http://mail.python.org/mailman/listinfo/python-list

Re: How to initialize a class variable once

2008-12-08 Thread Benjamin Kaplan
On Mon, Dec 8, 2008 at 11:44 PM, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 9, 3:36 pm, Matimus <[EMAIL PROTECTED]> wrote: > > On Dec 8, 8:08 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > > > > > I've got a class with a class variable: > > > > > class Foo: > > >_map = {} > > > > > How do I m

Re: "as" keyword woes

2008-12-08 Thread alex23
On Dec 9, 5:21 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > What I can say is that it certainly does take balls to see matters > from the other guy's perspective instead of calling someone names for > pointing something out. >From my perspective, it was less the original complaint and more the sud

Re: How to initialize a class variable once

2008-12-08 Thread John Machin
On Dec 9, 3:36 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Dec 8, 8:08 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > > > I've got a class with a class variable: > > > class Foo: > >    _map = {} > > > How do I make sure this only gets initialized the *first* time the > > module containing the class is

Re: Rich Comparisons Gotcha

2008-12-08 Thread Rhamphoryncus
On Dec 8, 7:44 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 08 Dec 2008 10:20:56 -0800, Rhamphoryncus wrote: > > On Dec 7, 4:20 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > >> On Sun, 07 Dec 2008 15:32:53 -0600, Robert Kern wrote: > >> > Rasmus Fogh wrote: > >

Re: How to initialize a class variable once

2008-12-08 Thread alex23
On Dec 9, 2:08 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > I've got a class with a class variable: > > class Foo: >    _map = {} > > How do I make sure this only gets initialized the *first* time the > module containing the class is imported?  What appears to be happening > as it stands is each time

Re: How to initialize a class variable once

2008-12-08 Thread Matimus
On Dec 8, 8:08 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > I've got a class with a class variable: > > class Foo: >    _map = {} > > How do I make sure this only gets initialized the *first* time the > module containing the class is imported?  What appears to be happening > as it stands is each time

Re: built-in functions as class attributes

2008-12-08 Thread alex23
On Dec 8, 8:46 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > Here's a curiosity:  after > > def my_hex(x): >     return hex(x) > > one might expect hex and my_hex to be interchangeable > in most situations.  But (with both Python 2.x and 3.x) > I get: > > >>> def my_hex(x): return hex(x) > ... >

Re: A question about reference in Python.

2008-12-08 Thread Joe Strout
On Dec 8, 2008, at 7:43 PM, Steven D'Aprano wrote: On Mon, 08 Dec 2008 08:18:27 -0700, Joe Strout wrote: On Dec 7, 2008, at 10:26 PM, Group wrote: Now, I want to write a Red-Black Tree, and a List structure. In C/C + +, I can use pointers to refer to children notes (or next notes). But, i

Re: pretty strange behavior of "strip"

2008-12-08 Thread Tim Roberts
Guy Doune <[EMAIL PROTECTED]> wrote: >Ok, didn't show the whole problem... > >I will read the doc anyway, but why "questions.html" keep it "t"?? > > >>> test=['03.html', '06.html', 'questions.html', '04.html', >'toc.html', '01.html', '05.html', '07.html', '02.html', '08.html'] > >>> test[4] >'toc

Re: RuntimeError: dictionary changed size during iteration

2008-12-08 Thread John Machin
On Dec 9, 3:00 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 08 Dec 2008 19:10:00 -0800, Robert Dailey wrote: > > On Dec 8, 6:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > >> Robert Dailey wrote: > >> > stuff = vars() > > >>  >>> vars() is globals() > >> True > > >> > for key in stuff:

How to initialize a class variable once

2008-12-08 Thread Roy Smith
I've got a class with a class variable: class Foo: _map = {} How do I make sure this only gets initialized the *first* time the module containing the class is imported? What appears to be happening as it stands is each time the module gets imported, Foo._map get re- initialized. -- http://ma

Re: RuntimeError: dictionary changed size during iteration

2008-12-08 Thread Steven D'Aprano
On Mon, 08 Dec 2008 19:10:00 -0800, Robert Dailey wrote: > On Dec 8, 6:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: >> Robert Dailey wrote: >> > stuff = vars() >> >>  >>> vars() is globals() >> True >> >> > for key in stuff: >> >> You just changed globals, which is aliased as stuff. Stuff changes

Re: Catching Python exceptions in C

2008-12-08 Thread Benjamin
On Dec 8, 12:42 pm, Senthil Kumar <[EMAIL PROTECTED]> wrote: > Hi Pythoneers ! > Can somebody give a quick solution? > I am trying to raise exceptions in python and trying to handle it in > C. > I am able to raise exceptions successfully. However could not catch > those in C. > I am using the follo

Re: RuntimeError: dictionary changed size during iteration

2008-12-08 Thread Robert Dailey
On Dec 8, 6:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Robert Dailey wrote: > > stuff = vars() > >  >>> vars() is globals() > True > > > for key in stuff: > > You just changed globals, which is aliased as stuff. > Stuff changes. > > >     print( key, '--', stuff[key] ) > > > I get the followin

Re: Rich Comparisons Gotcha

2008-12-08 Thread Steven D'Aprano
On Sun, 07 Dec 2008 16:24:58 -0800, George Sakkis wrote: > On Dec 7, 6:37 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: ... >> Given: >> >> x = log(-5)  # a NaN >> y = log(-2)  # the same NaN >> x == y  # Some people want this to be true for NaNs. >> >> Then: >> >> # Compare

Re: Rich Comparisons Gotcha

2008-12-08 Thread Steven D'Aprano
On Mon, 08 Dec 2008 10:20:56 -0800, Rhamphoryncus wrote: > On Dec 7, 4:20 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Sun, 07 Dec 2008 15:32:53 -0600, Robert Kern wrote: >> > Rasmus Fogh wrote: >> >> >> Current behaviour is both inconsistent and counterintuitive, as >

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Wesley MacIntosh
A flamer wrote: A moron, wrote: [snip] my machine (PPC Mac, OSX 10.4.x). Well, that explains a great deal. Actually, I suspect all these newsgroups are being trolled. -- http://mail.python.org/mailman/listinfo/python-list

Re: A question about reference in Python.

2008-12-08 Thread Steven D'Aprano
On Mon, 08 Dec 2008 08:18:27 -0700, Joe Strout wrote: > On Dec 7, 2008, at 10:26 PM, Group wrote: > >> Now, I want to write a Red-Black Tree, and a List structure. In C/C+ +, >> I can >> use pointers to refer to children notes (or next notes). But, in >> Python, how >> can I do it? Except the s

Re: Rich Comparisons Gotcha

2008-12-08 Thread Steven D'Aprano
On Mon, 08 Dec 2008 14:24:59 +, Rasmus Fogh wrote: > For my personal problem I could indeed wrap all objects in a wrapper > with whatever 'correct' behaviour I want (thanks, TJR). It does seem a > bit much, though, just to get code like this to work as intended: > alist.append(x) > print (

Re: Calling function from a string

2008-12-08 Thread Steven D'Aprano
On Mon, 08 Dec 2008 14:29:01 -0800, Chris Rebert wrote: > On Mon, Dec 8, 2008 at 2:23 PM, Robert Dailey <[EMAIL PROTECTED]> > wrote: >> Hi, >> >> I have a string representing the name of a function in Python 3.0. How >> can I call the function name represented by this string *without* >> creating

Google Summer of Code 2009

2008-12-08 Thread Eric
Hello, I am interested in participating in Google Summer of Code 2009, hopefully for something in Python. I realize that this is way before it begins, but I would like to start to get to know the community better and find something that I could work on during the summer of code. I know a decent a

sell lotro gold ,This is the professional Lotro gold shop,come on!www.lotro-shop.com

2008-12-08 Thread www.lotro-shop.com
In The Lord of the Rings OnlineTM: Shadows of AngmarTM (LOTRO), players can customize certain elements of the game's user interface (UI), also known as "skinning." While we don't allow you to do a full- scale UI replacement, we do give you the ability to replace selected visual elements of the UI.

Re: getting error...... Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in open_workbook biff_version = bk.getb

2008-12-08 Thread John Machin
On Dec 9, 12:19 pm, JodyGnumeric <[EMAIL PROTECTED]> wrote: > On Dec 8, 5:54 am, John Machin <[EMAIL PROTECTED]> wrote: > > > > > On Dec 8, 6:48 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <[EMAIL PROTECTED]>   > > > escribió: > > > > > ha

Re: Programming exercises/challenges

2008-12-08 Thread Edwin
On Nov 22, 2:15 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > I'm only a very occasional user of vi, so I don't really know how vim > integrates with MacOS X but have you tried aquamacs > (http://aquamacs.org/)? > > -- > Arnaud I've tried it but I ended up using original (I'm sure there's a be

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Terry Reedy
Jon Harrop wrote: [EMAIL PROTECTED] wrote: For the interested, with MMA 6, on a Pentium 4 3.8Ghz: The code that Jon posted: Timing[Export["image-jon.pgm", [EMAIL PROTECTED]@Main[2, 100, 4]]] {80.565, "image-jon.pgm"} That is not the code I posted: you are using Xah's parameters that generate

Re: getting error...... Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in open_workbook biff_version = bk.getb

2008-12-08 Thread JodyGnumeric
On Dec 8, 5:54 am, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 8, 6:48 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <[EMAIL PROTECTED]>   > > escribió: > > > > hallo everybody, > > > when i am running the following command > > >

Re: how to add command line flags to distutils setup script?

2008-12-08 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > Suppose I have a setup.py script which imports distutils.core.setup. Is > there some way to, for example, add a command line flag to the build command > so that I can run it like > > python setup.py build --frob=True > > ? You should inherit from the build comman

Re: python-devel download and install

2008-12-08 Thread Martin v. Löwis
> I am developing in Python version 2.5.2 and need to install and download > the python-devel library. (This is needed so I can build and install > mysql-python.) Where can I find find this module to download and > build/installation instructions? I have been unable to find the source > online t

Re: Rich Comparisons Gotcha

2008-12-08 Thread Terry Reedy
Robert Kern wrote: Terry Reedy wrote: Rasmus Fogh wrote: much, though, just to get code like this to work as intended: alist.append(x) print ('x is present: ', x in alist) Even if rich comparisons as you propose, the above would *still* not necessarily work. Collection classes can def

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
[EMAIL PROTECTED] wrote: > For the interested, with MMA 6, on a Pentium 4 3.8Ghz: > > The code that Jon posted: > > Timing[Export["image-jon.pgm", [EMAIL PROTECTED]@Main[2, 100, 4]]] > {80.565, "image-jon.pgm"} That is not the code I posted: you are using Xah's parameters that generate a differe

Re: Number of Python 3.x packages at the PyPI

2008-12-08 Thread Martin v. Löwis
>> On second thought: can't you just include the source of both versions >> in a single source distribution file? > > The .tar.gz distributions are built by distutils/setuptools. If I > manually combine them into a single archive That's not what I'm proposing, though. Assuming you have two differ

how to add command line flags to distutils setup script?

2008-12-08 Thread skip
Suppose I have a setup.py script which imports distutils.core.setup. Is there some way to, for example, add a command line flag to the build command so that I can run it like python setup.py build --frob=True ? I see that the setup function takes an options parameter but the distutils.core

python-devel download and install

2008-12-08 Thread Brian Wallace
Hi Folks, I am developing in Python version 2.5.2 and need to install and download the python-devel library. (This is needed so I can build and install mysql-python.) Where can I find find this module to download and build/installation instructions? I have been unable to find the source online

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
Xah Lee wrote: > A moron, wrote: > > You failed the challenge that you were given. > > you didn't give me a challenge. Thomas gave you the challenge: "What I want in return is you to execute and time Dr. Harrop's original code, posting the results to this thread... By Dr. Harrop's original cod

Re: Guido's new method definition idea

2008-12-08 Thread william tanksley
On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > I'd like this new way of defining methods, what do you guys think? > Anyone ready for writing a PEP? I think it's an awesome proposal. It's about time! With this change, defining methods uses the same special syntax hack that call

Re: RuntimeError: dictionary changed size during iteration

2008-12-08 Thread Terry Reedy
Robert Dailey wrote: stuff = vars() >>> vars() is globals() True for key in stuff: You just changed globals, which is aliased as stuff. Stuff changes. print( key, '--', stuff[key] ) I get the following error message: ('CopyEmotionFX', '--', ) Traceback (most recent call last): F

Re: how to get a beep, OS independent ?

2008-12-08 Thread Gabriel Genellina
En Sun, 07 Dec 2008 23:34:17 -0200, Joe Strout <[EMAIL PROTECTED]> escribió: On Dec 7, 2008, at 4:43 PM, Steven D'Aprano wrote: Of course, if you're volunteering to write such a standard system beep for Python, I for one would be grateful. I am. But where should I put it? Assuming we don't

Re: Don't you just love writing this sort of thing :)

2008-12-08 Thread Gabriel Genellina
En Sun, 07 Dec 2008 05:34:39 -0200, Lawrence D'Oliveiro <[EMAIL PROTECTED]> escribió: In message <[EMAIL PROTECTED]>, Arnaud Delobelle wrote: * you give the impression of being arrogant; Oddly enough, I wasn't the one who started by criticizing other people's code. I have no ego about my

Re: mod_python and files directory

2008-12-08 Thread Gabriel Genellina
En Sat, 06 Dec 2008 09:26:40 -0200, mete <[EMAIL PROTECTED]> escribió: but i want to take it somewhere else...i want to it work some other path in other system. os.path.dirname(os.path.abspath(__file__)) returns the directory where the current file resides. Execute it early in your code. --

Re: Shutdown Mac OSX computer using python

2008-12-08 Thread has
On 8 Dec, 09:26, Håkan Hagenrud <[EMAIL PROTECTED]> wrote: > Hello, i'm a python noob! > > But I would like to shutdown a 10.5.x mac computer using python (2.5.1) > > this is my code: > #!/usr/bin/python > import SystemEvents > down = SystemEvents.Power_Suite.Power_Suite_Events() > down.shut_down()

Re: Rich Comparisons Gotcha

2008-12-08 Thread Rhamphoryncus
On Dec 8, 2:51 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Rhamphoryncus wrote: > > "We've always done it that way" is NOT a use case!  Certainly, it's a > > factor, but it seems quite weak compared to the sort use case. > > I didn't say it was. I was explaining that sorting was probably *not* a u

Re: Number of Python 3.x packages at the PyPI

2008-12-08 Thread has
On 7 Dec, 19:53, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I've had to fork my appscript project's codebase in order to add > > support for Python 3.x. I would like to distribute both 2.x and 3.x > > versions under the same package name for obvious reasons. This isn't a > > problem with eggs

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Xah Lee
Dear George Neuner, Xah Lee wrote: > >The phenomenon of creating code that are inefficient is proportional > >to the highlevelness or power of the lang. In general, the higher > >level of the lang, the less possible it is actually to produce a code > >that is as efficient as a lower level lang. G

Re: tabs and spaces in py3k

2008-12-08 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Do the Py3k docs need correction? -tt option in python 2.x is now default in python 3.0. Apparently it got slipped from any documentation, including what's new. http://bugs.python.org/issue4603 -- http://mail.python.org/mailman/listinfo/python-list

Re: Rich Comparisons Gotcha

2008-12-08 Thread Robert Kern
MRAB wrote: Terry Reedy wrote: Rasmus Fogh wrote: For my personal problem I could indeed wrap all objects in a wrapper with whatever 'correct' behaviour I want (thanks, TJR). It does seem a bit I was not suggesting that you wrap *everything*, merely an adaptor for numpy arrays in whatever

RuntimeError: dictionary changed size during iteration

2008-12-08 Thread Robert Dailey
I'm executing the following code: def CopyBoost( libraries ): pass def CopyEmotionFX( libraries ): pass def Copy( library, aliases ): pass stuff = vars() for key in stuff: print( key, '--', stuff[key] ) I get the following error message: ('CopyEmotionFX', '--', ) Traceback (

Re: Rich Comparisons Gotcha

2008-12-08 Thread MRAB
Terry Reedy wrote: Rasmus Fogh wrote: For my personal problem I could indeed wrap all objects in a wrapper with whatever 'correct' behaviour I want (thanks, TJR). It does seem a bit I was not suggesting that you wrap *everything*, merely an adaptor for numpy arrays in whatever subclass and s

Re: Text parsing via regex

2008-12-08 Thread Robert Kern
Robocop wrote: Wow! Thanks for all the input, it looks like that textwrapper will work great for my needs. And thanks for the regex help everyone. Also, i was thinking of using a list, but i haven't used them much in python. Is there anything in python that is equivalent to pushback in c++ for

Re: Text parsing via regex

2008-12-08 Thread Robocop
Wow! Thanks for all the input, it looks like that textwrapper will work great for my needs. And thanks for the regex help everyone. Also, i was thinking of using a list, but i haven't used them much in python. Is there anything in python that is equivalent to pushback in c++ for vectors? As in,

Re: Mathematica 7 compares to other languages

2008-12-08 Thread George Neuner
On Sun, 7 Dec 2008 14:53:49 -0800 (PST), Xah Lee <[EMAIL PROTECTED]> wrote: >The phenomenon of creating code that are inefficient is proportional >to the highlevelness or power of the lang. In general, the higher >level of the lang, the less possible it is actually to produce a code >that is as ef

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Xah Lee
2008-12-08 Xah Lee wrote: > > Also, in this discussion, thanks to Thomas M Hermann's $20 offered to > > me for my challenge to you, that i have taken the time to show working > > code that demonstrate many problems in your code. A moron, wrote: > You failed the challenge that you were given. yo

Re: Text parsing via regex

2008-12-08 Thread MRAB
Vlastimil Brom wrote: 2008/12/8 Robocop <[EMAIL PROTECTED]>: I'm having a little text parsing problem that i think would be really quick to troubleshoot for someone more versed in python and Regexes. I need to write a simple script that parses some arbitrarily long string every 50 characters, an

Re: Calling function from a string

2008-12-08 Thread Chris Rebert
On Mon, Dec 8, 2008 at 2:23 PM, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I have a string representing the name of a function in Python 3.0. How > can I call the function name represented by this string *without* > creating a mapping? Assuming the function is within scope: return_val = v

Re: Text parsing via regex

2008-12-08 Thread MRAB
Paul McGuire wrote: On Dec 8, 12:13 pm, Robocop <[EMAIL PROTECTED]> wrote: I'm having a little text parsing problem that i think would be really quick to troubleshoot for someone more versed in python and Regexes. I need to write a simple script that parses some arbitrarily long string every 50

Calling function from a string

2008-12-08 Thread Robert Dailey
Hi, I have a string representing the name of a function in Python 3.0. How can I call the function name represented by this string *without* creating a mapping? -- http://mail.python.org/mailman/listinfo/python-list

Re: Strengths and weaknesses of Pygame vs. pyglet vs. PyOpenGL?

2008-12-08 Thread Terry Reedy
illume wrote: On Dec 8, 7:31 pm, alex23 <[EMAIL PROTECTED]> wrote: On Dec 8, 2:26 pm, illume <[EMAIL PROTECTED]> wrote: pygame is simpler to learn, since it doesn't require you to know how to create classes or functions. I'm not sure if I'd be quick to tout that as an advantage... :) Hi, I

Re: Public imports

2008-12-08 Thread Bruno Desthuilliers
Márcio Faustino a écrit : So, no chance of doing this: # "A.py" from __future__ import division, with_statement # "B.py" from A import * print 1 / 2 ...and printing 0.5, right? Nope, but for totally unrelated reasons (cf Skip's anwer). OTHO, this is valid: # foo.py def bar(): return "ba

Re: Rich Comparisons Gotcha

2008-12-08 Thread Robert Kern
Terry Reedy wrote: Rasmus Fogh wrote: much, though, just to get code like this to work as intended: alist.append(x) print ('x is present: ', x in alist) Even if rich comparisons as you propose, the above would *still* not necessarily work. Collection classes can define a __contains__ t

close has no effect on Mac OSX Python 3.0

2008-12-08 Thread resi147
I'm wondering if it's really a bug since it's so trivial: fp = open('/etc/services') ct = fp.read(1048) print(ct[-80:], end='') fp.close() ct = fp.read(17) print(ct) the second read should fail, but happily continues reading the file. Really a bug? As said in the subject,

Re: Beginner trying to understand functions.

2008-12-08 Thread Terry Reedy
cadmuxe wrote: i think we should use raw_input('Please enter your name: ') instead of input('Please enter your name: ') 3.0 input == 2.x raw_input 2.5 input == Posters: please include Python version used, as correct answers may depend on that. -- http://mail.python.org/mailman/listinfo/pyt

Re: Rich Comparisons Gotcha

2008-12-08 Thread Terry Reedy
Rasmus Fogh wrote: For my personal problem I could indeed wrap all objects in a wrapper with whatever 'correct' behaviour I want (thanks, TJR). It does seem a bit I was not suggesting that you wrap *everything*, merely an adaptor for numpy arrays in whatever subclass and source it is that fee

Re: Calling C# COM (.NET) from python

2008-12-08 Thread Mike Driscoll
On Dec 8, 3:33 pm, Andrew Falanga <[EMAIL PROTECTED]> wrote: > On Dec 8, 11:52 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > > > On Dec 8, 11:14 am, Ben Kaplan <[EMAIL PROTECTED]> wrote: > > > > On Dec 8, 2008, at 11:53 AM, Andrew Falanga <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I've

Re: Rich Comparisons Gotcha

2008-12-08 Thread Robert Kern
Rhamphoryncus wrote: On Dec 8, 1:04 pm, Robert Kern <[EMAIL PROTECTED]> wrote: Rhamphoryncus wrote: On Dec 8, 11:54 am, Robert Kern <[EMAIL PROTECTED]> wrote: Rhamphoryncus wrote: On Dec 7, 4:20 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: On Sun, 07 Dec 2008 15:32:53 -0

Re: Public imports

2008-12-08 Thread Diez B. Roggisch
Márcio Faustino schrieb: So, no chance of doing this: # "A.py" from __future__ import division, with_statement # "B.py" from A import * print 1 / 2 ...and printing 0.5, right? Too bad :) Au contraire - *very* good. If it were otherwise, what would happen to code that _relies_ on / returning

Re: easy_install of module produces un-importable result

2008-12-08 Thread Val
On Dec 8, 2:57 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Val schrieb:> I've written my first module, " > > " and uploaded it as an egg to > > > PyPI. I can use easy_istall to install my own module, but when I try > > to import it I get an ImportError "No module named gpsparser". > > > So

Re: xml.dom.minidom bug ?

2008-12-08 Thread Diez B. Roggisch
Sampsa Riikonen schrieb: Dear All, I am experiencing a weird problem with the xml.dom.minidom module: [EMAIL PROTECTED]:~/python> python easyxml.py Traceback (most recent call last): File "easyxml.py", line 1, in import xml.dom.minidom File "/u

Re: how to get a beep, OS independent ?

2008-12-08 Thread Jorgen Grahn
On 7 Dec 2008 14:46:53 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sun, 07 Dec 2008 07:17:30 -0700, Joe Strout wrote: > >> But invoking the standard system beep is such a basic function that it >> ought to be easier than this. I'm pretty sure it's a single OS call on >> all platf

Re: ORB for Python and PHP

2008-12-08 Thread Diez B. Roggisch
Laszlo Nagy schrieb: We have a problem here. We have a website written in PHP. and many programs written in Python. The communication between the components is messy. os.system calls are mixed with popen, xml-rpc and others. We would like to make it consistent and portable. We would like to use

Re: Calling C# COM (.NET) from python

2008-12-08 Thread Andrew Falanga
On Dec 8, 11:52 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Dec 8, 11:14 am, Ben Kaplan <[EMAIL PROTECTED]> wrote: > > > > > On Dec 8, 2008, at 11:53 AM, Andrew Falanga <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I've never programmed in python and only have a small understanding of > > >

Re: Source code generation using Python

2008-12-08 Thread Jorgen Grahn
On Sat, 6 Dec 2008 13:47:26 -0800 (PST), ats <[EMAIL PROTECTED]> wrote: > Hello, > > This is my first posting to a Python group (and I'm starting with > Python seriously only now) , so bear with me if I make some mistakes. > > I want to generate 3 different versions of a C++ source code, > basicall

Re: StringIO in 2.6 and beyond

2008-12-08 Thread Bill McClain
On 2008-12-08, Christian Heimes <[EMAIL PROTECTED]> wrote: > In this context 'str' means Python 3.0's str type, which is unicode in > 2.x. Please report the misleading error message. So this is an encoding problem? Can you give me a hint on how to correct in my example? I see that io.StringIO()

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
Xah Lee wrote: > Also, in this discussion, thanks to Thomas M Hermann's $20 offered to > me for my challenge to you, that i have taken the time to show working > code that demonstrate many problems in your code. You failed the challenge that you were given. Specifically, your code is not measurabl

Re: Guido's new method definition idea

2008-12-08 Thread Aaron Brady
On Dec 8, 2:55 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > class C: > >     def createfunc(self): > >         def self.func(arg): > >             return arg + 1 > > > Or, after the class definition is done, to extend it dynamically: > > > def C.method(self, arg):

ORB for Python and PHP

2008-12-08 Thread Laszlo Nagy
We have a problem here. We have a website written in PHP. and many programs written in Python. The communication between the components is messy. os.system calls are mixed with popen, xml-rpc and others. We would like to make it consistent and portable. We would like to use free software. What

Re: Rich Comparisons Gotcha

2008-12-08 Thread Rhamphoryncus
On Dec 8, 1:04 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Rhamphoryncus wrote: > > On Dec 8, 11:54 am, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Rhamphoryncus wrote: > >>> On Dec 7, 4:20 pm, Steven D'Aprano <[EMAIL PROTECTED] > >>> cybersource.com.au> wrote: > On Sun, 07 Dec 2008 15:32:53

RE: Guido's new method definition idea

2008-12-08 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Aaron Brady > Sent: Monday, December 08, 2008 3:27 PM > To: python-list@python.org > Subject: Re: Guido's new method definition idea > > On Dec 7, 4:23 pm, Philip Slate <[EMAIL PROTECTED]> wrot

Re: Guido's new method definition idea

2008-12-08 Thread Patrick Mullen
On Mon, Dec 8, 2008 at 12:55 PM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > >> class C: >> def createfunc(self): >> def self.func(arg): >> return arg + 1 >> >> Or, after the class definition is done, to extend it dynamically: >> >> def C.method

Re: how to get a beep, OS independent ?

2008-12-08 Thread J. Cliff Dyer
On Sun, 2008-12-07 at 21:13 +, Peter Pearson wrote: > On Sun, 07 Dec 2008 00:40:53 +0100, Stef Mientki wrote: > > > > I want to give a small beep, > > for windows there's message-beep, > > and there seems to be something like " curses" , > > but that package seems to be totally broken in P2.5

xml.dom.minidom bug ?

2008-12-08 Thread Sampsa Riikonen
Dear All, I am experiencing a weird problem with the xml.dom.minidom module: [EMAIL PROTECTED]:~/python> python easyxml.py Traceback (most recent call last): File "easyxml.py", line 1, in import xml.dom.minidom File "/usr/lib64/python2.5/site-pack

Re: Guido's new method definition idea

2008-12-08 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: > class C: > def createfunc(self): > def self.func(arg): > return arg + 1 > > Or, after the class definition is done, to extend it dynamically: > > def C.method(self, arg): > self.value = arg > > ...which would be the equivalent of the followin

Re: Text parsing via regex

2008-12-08 Thread Vlastimil Brom
2008/12/8 Robocop <[EMAIL PROTECTED]>: > I'm having a little text parsing problem that i think would be really > quick to troubleshoot for someone more versed in python and Regexes. > I need to write a simple script that parses some arbitrarily long > string every 50 characters, and does not parse

Re: datetime and the rich-companison operators

2008-12-08 Thread Ethan Furman
Chris Rebert wrote: On Sun, Dec 7, 2008 at 11:41 PM, Ethan Furman <[EMAIL PROTECTED]> wrote: Greetings All! I am implementing a NullDate class in order to mirror dates and datetimes that have no value (yes, this is for my dbf module :) I'm still a bit fuzzy about class methods, hashing, and

Re: Guido's new method definition idea

2008-12-08 Thread Aaron Brady
On Dec 7, 4:23 pm, Philip Slate <[EMAIL PROTECTED]> wrote: > On Dec 7, 1:13 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > > and friendlier to newbies. > > > I'd rather say "more acceptable to java-brainwashed developpers". > > And I'd rather say you're trolling, but that's ok since you

Re: A question about reference in Python.

2008-12-08 Thread Aaron Brady
On Dec 8, 9:18 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Dec 7, 2008, at 10:26 PM, Group wrote: > > > Now, I want to write a Red-Black Tree, and a List structure. In C/C+ > > +, I can > > use pointers to refer to  children  notes (or next notes). But, in   > > Python, how > > can I do it? Exce

Re: how to get a beep, OS independent ?

2008-12-08 Thread Stef Mientki
Joe Strout wrote: On Dec 7, 2008, at 4:43 PM, Steven D'Aprano wrote: Of course, if you're volunteering to write such a standard system beep for Python, I for one would be grateful. I am. But where should I put it? Assuming we don't want to wait for the (understandably) lengthy and contenti

  1   2   3   >