Announce: Pyevolve 0.5 released !

2009-01-24 Thread Perone
The Pyevolve v.0.5 was released. Pyevolve was developed to be a complete genetic algorithms framework written in pure python. More information at: http://pyevolve.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation:

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-24 Thread Carl Banks
On Jan 23, 11:45 pm, Bryan Olson fakeaddr...@nowhere.org wrote: Carl Banks wrote: Classes in Python are mutable types, usually.  Class instances are (except for the refcount) immutable objects, usually. There's where we disagree. I assert that class instances are usually mutable objects.

Re: Two import questions in Python 3.0

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 05:24:15 -0200, Kay Schluehr kay.schlu...@gmx.net escribió: 1. I'd expected that absolute imports are used in Python 3.0 by default. I may be wrong. I've written two versions of a module sucks.py sucks.py - print (import from lib.sucks) sucks.py -

Re: Why GIL?

2009-01-24 Thread Hrvoje Niksic
Carl Banks pavlovevide...@gmail.com writes: On Jan 23, 11:45 pm, Bryan Olson fakeaddr...@nowhere.org wrote: Carl Banks wrote: Classes in Python are mutable types, usually.  Class instances are (except for the refcount) immutable objects, usually. There's where we disagree. I assert that

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 06:06:02 -0200, Carl Banks pavlovevide...@gmail.com escribió: On Jan 23, 11:45 pm, Bryan Olson fakeaddr...@nowhere.org wrote: Carl Banks wrote: Classes in Python are mutable types, usually.  Class instances are (except for the refcount) immutable objects, usually.

Re: Stalled ticket in Python bug tracker

2009-01-24 Thread Peter Otten
Steven D'Aprano wrote: I'm interested in this ticket in the bug tracker: http://bugs.python.org/issue2527 but it seems to have been stalled for nine months. Is there a procedure for starting it up again? Should I ask about it on the python-dev mailing list, or just wait until somebody

Re: Why GIL?

2009-01-24 Thread Paul Rubin
Hrvoje Niksic hnik...@xemacs.org writes: Not only registered at the beginning of the function, but also (since CPython uses C, not C++) explicitly unregistered at every point of exit from the function. Emacs implements these as macros called GCPRO and UNGCPRO, and they're very easy to get

Web authentication urllib2

2009-01-24 Thread Gabriel
Hello, I'm new in Python and i would like to write script which need to login to a website. I'm experimenting with urllib2, especially with something like this: opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener) params =

Re: strange error whilst porting to 2.6

2009-01-24 Thread Steve Holden
Benjamin Peterson wrote: Robin Becker robin at NOSPAMreportlab.com writes: Well that's not really acceptable as a solution is it? :) This doesn't happen in Python 3.0, so you could port to that. :) In 2.7, the better recursion depth handling in Py3k may be backported,but the best you

Re: Relax Syntax for Augmented Arithmetic?

2009-01-24 Thread Steve Holden
Aahz wrote: In article mailman.7801.1232715276.3487.python-l...@python.org, Steve Holden st...@holdenweb.com wrote: I understand what you are saying, but if the id() associated with a name doesn't change after augmented assignment it seems a little wrong-headed to argue that the augmented

Re: var is None vs. var == None

2009-01-24 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 23 Jan 2009 20:33:45 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: Hi -- Some time ago I ran across a comment recommending using var is None instead of var == None (also var is not None, etc.)

Re: Two import questions in Python 3.0

2009-01-24 Thread Kay Schluehr
On 24 Jan., 09:21, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: If you run A.py as a script, it does not know it lives inside a package. You must *import* A for it to become aware of the package. Also, the directory containing the script comes earlier than PYTHONPATH entries in sys.path --

Re: strange error whilst porting to 2.6

2009-01-24 Thread Robin Becker
Steve Holden wrote: Benjamin Peterson wrote: Robin Becker robin at NOSPAMreportlab.com writes: Well that's not really acceptable as a solution is it? :) This doesn't happen in Python 3.0, so you could port to that. :) my initial attempts in this direction were even less successful :(

Re: Web authentication urllib2

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 06:52:57 -0200, Gabriel dun...@dreams.sk escribió: I'm new in Python and i would like to write script which need to login to a website. I'm experimenting with urllib2, especially with something like this: opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-24 Thread Steve Holden
Carl Banks wrote: On Jan 23, 8:22 pm, Bryan Olson fakeaddr...@nowhere.org wrote: Paul Rubin wrote: Bryan Olson writes: BTW, class instances are usually immutable and thus don't require a mutex in the system I described. Then you are describing a language radically different from Python.

Re: Web authentication urllib2

2009-01-24 Thread Steve Holden
Gabriel wrote: Hello, I'm new in Python and i would like to write script which need to login to a website. I'm experimenting with urllib2, especially with something like this: opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener)

Re: The First Law Of comp.lang.python Dynamics

2009-01-24 Thread Hendrik van Rooyen
Martin P. Hellwig martin.hell...@dcuktec.org wrote: Or you can argue that even when an argument is repeated indefinitely it doesn't make it suddenly right. This is no good. It's a well known fact that anything I tell you three times is true. To demonstrate: Tim Rowe's post earlier in this

Re: Does Python really follow its philosophy of Readability counts?

2009-01-24 Thread Steven D'Aprano
On Fri, 23 Jan 2009 21:36:59 -0500, Luis Zarrabeitia wrote: Quoting Steven D'Aprano st...@remove-this-cybersource.com.au: On Fri, 23 Jan 2009 13:07:55 -0500, Luis Zarrabeitia wrote: It should be in _our_ power as the team of all participant coders on _our_ project to decide if we should

Re: About SCons Re: progress: compiling python2.5 under msys (specifically but not exclusively under wine) with msvcr80

2009-01-24 Thread anatoly techtonik
On Sat, Jan 24, 2009 at 12:28 AM, Roumen Petrov I would better use SCons for both unix and windows builds. In case of windows for both compilers - mingw and microsoft ones. To port curses extension to windows I need to know what gcc options mean, what are the rules to write Makefiles and how

Re: Web authentication urllib2

2009-01-24 Thread Gabriel
First, thank you both I think this isn't basic auth, because this page has form login. I read site's html source and used wireshark to analyze communication between my browser and website and i really find out that a was ignoring one field I added it to the parameters but it didn't help..

Re: Web authentication urllib2

2009-01-24 Thread Gabriel
Oh, nevermind, it's working. Thanks Gabriel wrote: First, thank you both I think this isn't basic auth, because this page has form login. I read site's html source and used wireshark to analyze communication between my browser and website and i really find out that a was ignoring one field

Re: A java hobbyist programmer learning python

2009-01-24 Thread TheFlyingDutchman
On Jan 23, 8:57 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Fri, 23 Jan 2009 01:48:32 -0800 (PST), TheFlyingDutchman zzbba...@aol.com declaimed the following in comp.lang.python: abstraction. In Python, all class attributes are public but names may be mangled to discourage

Re: Web authentication urllib2

2009-01-24 Thread Steve Holden
Gabriel wrote: First, thank you both I think this isn't basic auth, because this page has form login. I read site's html source and used wireshark to analyze communication between my browser and website and i really find out that a was ignoring one field I added it to the parameters but

Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread andrew cooke
Hi, I have some 3.0 code, which I would like to make work with 2.6. However, there does not seem to be support for the new super() (no args) via __future__. Is that correct? If so, what's the best way to handle this? Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Web authentication urllib2

2009-01-24 Thread Gabriel
Yep, i realize this a minute after posting, sorry. And thank you again .) Steve Holden wrote: Gabriel wrote: First, thank you both I think this isn't basic auth, because this page has form login. I read site's html source and used wireshark to analyze communication between my browser and

What's the business with the asterisk?

2009-01-24 Thread mk
Hello everyone, From time to time I spot an asterisk (*) used in the Python code _outside_ the usual *args or **kwargs application. E.g. here: http://www.norvig.com/python-lisp.html def transpose (m): return zip(*m) transpose([[1,2,3], [4,5,6]]) [(1, 4), (2, 5), (3, 6)] What does *m mean

Re: What's the business with the asterisk?

2009-01-24 Thread Tim Chase
From time to time I spot an asterisk (*) used in the Python code _outside_ the usual *args or **kwargs application. E.g. here: http://www.norvig.com/python-lisp.html def transpose (m): return zip(*m) transpose([[1,2,3], [4,5,6]]) [(1, 4), (2, 5), (3, 6)] What does *m mean in this

pygccxml xml output file

2009-01-24 Thread whatazor
Hi all, I start to use this module in order to produce xml( and the make other things), but differently from gccxml I don't find the variable that set the name of the xml output file after the parsing (in gccxml is - fxml), so it creates temporary files. how can I do an Is there a tutorial that

Re: Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread Benjamin Peterson
andrew cooke andrew at acooke.org writes: Hi, I have some 3.0 code, which I would like to make work with 2.6. However, there does not seem to be support for the new super() (no args) via __future__. Is that correct? If so, what's the best way to handle this? Just use the two argument

Re: What's the business with the asterisk?

2009-01-24 Thread Kay Schluehr
On 24 Jan., 13:31, mk mrk...@gmail.com wrote: Hello everyone,  From time to time I spot an asterisk (*) used in the Python code _outside_ the usual *args or **kwargs application. E.g. here:http://www.norvig.com/python-lisp.html def transpose (m):    return zip(*m)   transpose([[1,2,3],

Re: What is intvar?

2009-01-24 Thread W. eWatson
W. eWatson wrote: r wrote: here is a good explanation of control vars: http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html Here are 3 great Tkinter refernces in order: http://infohost.nmt.edu/tcc/help/pubs/tkinter/ http://effbot.org/tkinterbook/

Re: Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread andrew cooke
On Jan 24, 10:39 am, Benjamin Peterson benja...@python.org wrote: andrew cooke andrew at acooke.org writes: Hi, I have some 3.0 code, which I would like to make work with 2.6. However, there does not seem to be support for the new super() (no args) via __future__.  Is that correct?  

Re: OCaml, Language syntax, and Proof Systems

2009-01-24 Thread Joe Riopel
On Fri, Jan 23, 2009 at 6:16 PM, Xah Lee xah...@gmail.com wrote: The haskell tutorials you can find online are the most mothefucking stupid unreadable fuck. The Haskll community is almost stupid. What they talk all day is about monads, currying, linder myer fuck type. That's what they talk

Re: Counter Class -- Bag/Multiset

2009-01-24 Thread pataphor
On Thu, 22 Jan 2009 10:11:37 -0800 (PST) Raymond Hettinger pyt...@rcn.com wrote: The collections module in Python 2.7 and Python 3.1 has gotten a new Counter class that works like bags and multisets in other languages. I like that! Now that we have a multiset or Counter I think a redefinition

Doc for extended call syntax; was: Re: unzip array of arrays?

2009-01-24 Thread Bryan Olson
Tobiah wrote: Where can I read about this mysterious use of the '*'? Hmmm... that's a harder question than I thought. Am I missing it, or does Python's doc need a write-up of the extended call syntax? It only works in the context of the zip() function. It's hard to understand how the

Re: Mathematica 7 compares to other languages

2009-01-24 Thread Jerry Gerrone
On Jan 21, 1:06 pm, soul.mirr...@gmail.com soul.mirr...@gmail.com wrote: On Dec 4 2008, 5:11 am, Andreas Waldenburger geekm...@usenot.de wrote: I vaguely remember you plonking [Xah Lee] before. Did you unplonk him in the meantime? Or was that just a figure of speech? teasingly yours, /W

understanding nested lists?

2009-01-24 Thread Vincent Davis
I have a short peace of code that is not doing what I expect. when I assign a value to a list in a list alist[2][4]=z this seems replace all the 4 elements in all the sub lists. I assume it is supposed to but this is not what I expect. How would I assign a value to the 4th element in the 2nd

String comparision

2009-01-24 Thread S.Selvam Siva
Hi all, I am developing spell checker for my local language(tamil) using python. I need to generate alternative word list for a miss-spelled word from the dictionary of words.The alternatives must be as much as closer to the miss-spelled word.As we know, ordinary string comparison wont work here

practical limits of urlopen()

2009-01-24 Thread webcomm
Hi, Am I going to have problems if I use urlopen() in a loop to get data from 3000+ URLs? There will be about 2KB of data on average at each URL. I will probably run the script about twice per day. Data from each URL will be saved to my database. I'm asking because I've never opened that many

Re: Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread Benjamin Peterson
andrew cooke andrew at acooke.org writes: Unfortunately, metaclass= is a syntax error in 2.6 so the following still fails: from sys import version if version.startswith('2.'): class Matcher(): pass else: class Matcher(metaclass=ABCMeta): pass I would suggest

Re: Web authentication urllib2

2009-01-24 Thread Steve Holden
Gabriel wrote: Yep, i realize this a minute after posting, sorry. And thank you again .) A pleasure. Next time, you might consider posting an explanation along with the it's working now message, just to give closure to the thread for anyone who ends up reading it later after a search. Good

Re: understanding nested lists?

2009-01-24 Thread Steve Holden
Vincent Davis wrote: I have a short peace of code that is not doing what I expect. when I assign a value to a list in a list alist[2][4]=z this seems replace all the 4 elements in all the sub lists. I assume it is supposed to but this is not what I expect. How would I assign a value to the 4th

Re: understanding nested lists?

2009-01-24 Thread Brian Allen Vanderburg II
vinc...@vincentdavis.net wrote: I have a short peace of code that is not doing what I expect. when I assign a value to a list in a list alist[2][4]=z this seems replace all the 4 elements in all the sub lists. I assume it is supposed to but this is not what I expect. How would I assign a value

Re: Two import questions in Python 3.0

2009-01-24 Thread Scott David Daniels
Kay Schluehr wrote: On 24 Jan., 09:21, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: If you run A.py as a script, it does not know it lives inside a package. You must *import* A for it to become aware of the package. Also, the directory containing the script comes earlier than PYTHONPATH

Re: practical limits of urlopen()

2009-01-24 Thread Steve Holden
webcomm wrote: Hi, Am I going to have problems if I use urlopen() in a loop to get data from 3000+ URLs? There will be about 2KB of data on average at each URL. I will probably run the script about twice per day. Data from each URL will be saved to my database. I'm asking because I've

RegEx issues

2009-01-24 Thread Sean Brown
Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm interested in extracting which is really a whole bunch of text. So I think the regex \[\[(.*)\]\]; should do

Parsing a string into a datetime object

2009-01-24 Thread Mark.Petrovic
Good day. Might someone comment on why %f is not accepted as a valid field directive in: from datetime import datetime created=2009-01-24 16:04:55.882788 dt = datetime.strptime(created,%Y-%m-%d %H:%M:%S.%f) Traceback (most recent call last): File stdin, line 1, in module File

Re: RegEx issues

2009-01-24 Thread Mark Tolonen
Sean Brown sbrown.h...@[spammy] gmail.com wrote in message news:glflaj$qr...@nntp.motzarella.org... Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm

Re: What is intvar?

2009-01-24 Thread Steve Holden
W. eWatson wrote: W. eWatson wrote: r wrote: here is a good explanation of control vars: http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html Here are 3 great Tkinter refernces in order: http://infohost.nmt.edu/tcc/help/pubs/tkinter/ http://effbot.org/tkinterbook/

Re: Web authentication urllib2

2009-01-24 Thread Scott David Daniels
Gabriel wrote: Yep, i realize this a minute after posting, sorry. And thank you again .) Steve Holden wrote: ... I'll offer a couple of pointers about what we all expect here. Please treat this as advice, not a shout of disapproval. (1) Do not top post (put your response above the previous

Re: Doc for extended call syntax; was: Re: unzip array of arrays?

2009-01-24 Thread Steve Holden
Bryan Olson wrote: Tobiah wrote: Where can I read about this mysterious use of the '*'? Hmmm... that's a harder question than I thought. Am I missing it, or does Python's doc need a write-up of the extended call syntax? No, you aren't mistaken. Looking at the * symbol in the 2.6

Re: Parsing a string into a datetime object

2009-01-24 Thread MRAB
Mark.Petrovic wrote: Good day. Might someone comment on why %f is not accepted as a valid field directive in: from datetime import datetime created=2009-01-24 16:04:55.882788 dt = datetime.strptime(created,%Y-%m-%d %H:%M:%S.%f) Traceback (most recent call last): File stdin, line 1, in

Re: RegEx issues

2009-01-24 Thread Steve Holden
Mark Tolonen wrote: Sean Brown sbrown.h...@[spammy] gmail.com wrote in message news:glflaj$qr...@nntp.motzarella.org... Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ...

Byte oriented data types in python

2009-01-24 Thread Ravi
I have following packet format which I have to send over Bluetooth. packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || packet_data(variable) How to construct these using python data types, as int and float have no limits and their sizes are not well defined. --

Re: RegEx issues

2009-01-24 Thread Roy Smith
Sean Brown sbrown.h...@[spammy]gmail.com wrote: The problem is it appears that python is escaping the \ in the regex because I see this: reg = '\[\[(.*)\]\];' The first trick of working with regexes in Python is to *always* use raw strings. Instead of reg = '\[\[(.*)\]\];' you want reg =

Re: RegEx issues

2009-01-24 Thread Scott David Daniels
Sean Brown wrote: I have the following string ...: td[ct] = [[ ... ]];\r\n The ... (representing text in the string) is what I'm extracting So I think the regex \[\[(.*)\]\]; should do it. The problem is it appears that python is escaping the \ in the regex because I see this: reg =

Re: Porting 3.0 to 2.6 - from __future__ import super missing?

2009-01-24 Thread andrew cooke
On Jan 24, 2:32 pm, Benjamin Peterson benja...@python.org wrote: I would suggest that you use the 2.6 syntax, and run 2to3 -f metaclass on your code. (ABCs have been backported to 2.6.) Thanks - with that hint I found this -

TEST=`which test` equivalent in python?

2009-01-24 Thread Jay Jesus Amorin
Hi, Kindly help. import sys, os, string *SVNLOOK_PATH=os.system('which svnlook')* def main(repos, txn): svnlook_cmd = '%s log -t %s %s' % (*SVNLOOK_PATH*, txn, repos) check_msg = os.popen(svnlook_cmd, 'r').readline().rstrip('\n') if len(check_msg) 10: sys.stderr.write

Re: Parsing a string into a datetime object

2009-01-24 Thread Hrvoje Niksic
Mark.Petrovic mspetro...@gmail.com writes: Might someone comment on why %f is not accepted as a valid field directive in: from datetime import datetime created=2009-01-24 16:04:55.882788 dt = datetime.strptime(created,%Y-%m-%d %H:%M:%S.%f) Traceback (most recent call last): File stdin,

Re: Byte oriented data types in python

2009-01-24 Thread Stephen Hansen
I have following packet format which I have to send over Bluetooth. packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || packet_data(variable) How to construct these using python data types, as int and float have no limits and their sizes are not well defined. Check out the

Re: TEST=`which test` equivalent in python?

2009-01-24 Thread Benjamin Kaplan
On Sat, Jan 24, 2009 at 2:03 PM, Jay Jesus Amorin jay.amo...@gmail.comwrote: Hi, Kindly help. import sys, os, string *SVNLOOK_PATH=os.system('which svnlook')* Read the docs on os.system. It returns the program's return code, not the child processes stdout. Use the subprocess module.

Re: RegEx issues

2009-01-24 Thread MRAB
Roy Smith wrote: [snip] Another trick when you're not 100% what you're looking at is to explode the string like this: [c for c in reg] ['\\', '[', '\\', '[', '(', '.', '*', ')', '\\', ']', '\\', ']', ';'] A shorter way is list(reg). -- http://mail.python.org/mailman/listinfo/python-list

Re: ossaudiodev problem: sawtooth noise

2009-01-24 Thread Peter Pearson
On Fri, 23 Jan 2009 14:55:36 -0200, Gabriel Genellina wrote: En Fri, 23 Jan 2009 14:36:46 -0200, Peter Pearson ppear...@nowhere.invalid escribió: On Thu, 22 Jan 2009 20:58:14 -0200, Gabriel Genellina wrote: En Mon, 19 Jan 2009 21:57:04 -0200, Peter Pearson ppear...@nowhere.invalid escribió:

Re: Byte oriented data types in python

2009-01-24 Thread Martin v. Löwis
packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || packet_data(variable) How to construct these using python data types, as int and float have no limits and their sizes are not well defined. In Python 2.x, use the regular string type: chr(n) will create a single byte, and

Re: Byte oriented data types in python

2009-01-24 Thread skip
Ravi packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || Ravi packet_data(variable) Ravi How to construct these using python data types, as int and float have Ravi no limits and their sizes are not well defined. Take a look at the struct and ctypes modules. --

MaxInt on Vista-64bit?

2009-01-24 Thread googler . 1 . webmaster
Hi! I downloaded Python64 for Windows Vista64 but the value returned from sys.maxint is just a 32bit integer. I found out, thats by design, Microsoft decided to make the long value 32bit. What can I do to compile python 2.6 with maxint of 64bit integers? Can I replace the int values to a int64

Re: understanding nested lists?

2009-01-24 Thread Vincent Davis
Thanks for the info. I did not know that. Thanks Vincent Davis On Sat, Jan 24, 2009 at 10:46 AM, Steve Holden st...@holdenweb.com wrote: Vincent Davis wrote: I have a short peace of code that is not doing what I expect. when I assign a value to a list in a list alist[2][4]=z this seems

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-24 Thread Carl Banks
On Jan 24, 12:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 24 Jan 2009 06:06:02 -0200, Carl Banks pavlovevide...@gmail.com   escribió: On Jan 23, 11:45 pm, Bryan Olson fakeaddr...@nowhere.org wrote: Carl Banks wrote: Classes in Python are mutable types, usually.  

Re: MaxInt on Vista-64bit?

2009-01-24 Thread Martin v. Löwis
I downloaded Python64 for Windows Vista64 but the value returned from sys.maxint is just a 32bit integer. I found out, thats by design, Microsoft decided to make the long value 32bit. What can I do to compile python 2.6 with maxint of 64bit integers? At a minimum, you need to change ob_ival

Re: MaxInt on Vista-64bit?

2009-01-24 Thread googler . 1 . webmaster
Hi! Thanks for the fast answer. Yes, its enough but I never thought that Vista64 is not a real 64-bit operating system :-o. -- http://mail.python.org/mailman/listinfo/python-list

Regex for Python 2.7

2009-01-24 Thread MRAB
Some time ago I discovered this difference between regular expressions in Python and Perl: Python \A matches at start of string \Z matches at end of string Perl \A matches at start of string \Z matches before terminal newline or at end of string \z

Re: Why GIL?

2009-01-24 Thread Carl Banks
On Jan 24, 12:33 am, Hrvoje Niksic hnik...@xemacs.org wrote: Carl Banks pavlovevide...@gmail.com writes: Anyway, all you're doing is distracting attention from my claim that instance objects wouldn't need to be locked.  They wouldn't, no matter how mutable you insist these objects whose

Re: Why GIL?

2009-01-24 Thread Carl Banks
On Jan 24, 12:24 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jan 24, 12:33 am, Hrvoje Niksic hnik...@xemacs.org wrote: Carl Banks pavlovevide...@gmail.com writes: Anyway, all you're doing is distracting attention from my claim that instance objects wouldn't need to be locked.  They

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-24 Thread Carl Banks
On Jan 24, 12:05 pm, Carl Banks pavlovevide...@gmail.com wrote: The default metatype for Python classes would be mutable_dict_type, which is a type wherein the object itself would be mutable but it would still have all the mutator methods __init__, __setattr__, etc., but they could only act on

Re: Dynamic methods and lambda functions

2009-01-24 Thread Michael Torrie
unine...@gmail.com wrote: The attributes are right, but the getter are not working. The problem is that the lambda function always execute the last parameter passed for all instances of the methods. How could it be done the right way? Basically, don't use a lambda. Create a real, local

Re: Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code?

2009-01-24 Thread Gerhard Häring
Casey Hawthorne wrote: Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code? I suppose I'm thinking of an extra layer of indirection, which might slow things down to much. Aren't this just Python libraries that

Re: I'm a python addict !

2009-01-24 Thread Lie Ryan
On Fri, 23 Jan 2009 19:58:09 -0700, Linuxguy123 wrote: I just started using python last week and I'm addicted. you need to try this: import antigravity http://xkcd.com/353/ -- http://mail.python.org/mailman/listinfo/python-list

Possible to slice a string with unpacked tuple?

2009-01-24 Thread python
Is there a way to slice a string with a tuple without unpacking the tuple? myString = 111-222-333-444 myString[ 4: 7 ] '222' Is there some way I could perform an identical slicing operation with a tuple like ( 4, 7 ) without having to unpack the tuple? myTuple = ( 4, 7 ) Thanks! Malcolm --

Re: Possible to slice a string with unpacked tuple?

2009-01-24 Thread Benjamin Kaplan
On Sat, Jan 24, 2009 at 5:31 PM, pyt...@bdurham.com wrote: Is there a way to slice a string with a tuple without unpacking the tuple? myString = 111-222-333-444 myString[ 4: 7 ] '222' Is there some way I could perform an identical slicing operation with a tuple like ( 4, 7 ) without

Re: I'm a python addict !

2009-01-24 Thread Benjamin Kaplan
On Sat, Jan 24, 2009 at 5:35 PM, Lie Ryan lie.1...@gmail.com wrote: On Fri, 23 Jan 2009 19:58:09 -0700, Linuxguy123 wrote: I just started using python last week and I'm addicted. you need to try this: import antigravity http://xkcd.com/353/ Just be careful with that. That guy was

Re: Possible to slice a string with unpacked tuple?

2009-01-24 Thread MRAB
pyt...@bdurham.com wrote: Is there a way to slice a string with a tuple without unpacking the tuple? myString = 111-222-333-444 myString[ 4: 7 ] '222' Is there some way I could perform an identical slicing operation with a tuple like ( 4, 7 ) without having to unpack the tuple?

Re: Possible to slice a string with unpacked tuple?

2009-01-24 Thread python
Benjamin, Use the built-in slice. Perfect!! That's exactly what I was looking for - I didn't know this object existed. What's wrong with unpacking the tuple? I'm extracting fields from a huge, multi-gig log file. I was trying to avoid doing something like myString[ myTuple[ 0 ]: myTuple[ 1 ] )

Re: Possible to slice a string with unpacked tuple?

2009-01-24 Thread python
MRAB, Does myString[myTuple[0] : myTuple[1]] count as unpacking? I'm not sure my use of the term 'unpacking' was totally correct, but, yes, that's what I was hoping to avoid with a simpler solution. then how about myString.__getslice__(*myTuple)? Very interesting. I'm going to try Ben's

Is (-1 ==True) True or False? Neither

2009-01-24 Thread oktaysafak
Hi all, I ran into a strange case. Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 ... >>> -1 == True False >>> -1 == False False This works though: >>> if -1: print "OK" OK After some head scratching, I realized that: - bool is a subclass of int and

Re: TEST=`which test` equivalent in python?

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 17:03:33 -0200, Jay Jesus Amorin jay.amo...@gmail.com escribió: *SVNLOOK_PATH=os.system('which svnlook')* You've been told what's wrong with that. But instead of fixing how to invoke which, use distutils.spawn.find_executable instead: py from distutils.spawn import

Can webbrowser module get source code?

2009-01-24 Thread Muddy Coder
Hi All, I played the demo of webbrowser module, with the code below: import webbrowser url = 'https://login.yahoo.com' webbrowser.open_new_tab(url) when I ran the code, it popped out a webpage nicely. I want to go further: to get the source code of the webpage being displayed. Is it possible to

why is this invalid b = a += b ?

2009-01-24 Thread Stef Mientki
hello, I can assign a value to more than 1 variable (name) in one line: a = b = 3 So evaluation of this line must start at the right part. But the following is not allowed: b = 2 a = b += 1 I would think that if b has a value, and the formula is evaluated from right to left, there's nothing

Re: Regex for Python 2.7

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 18:23:51 -0200, MRAB goo...@mrabarnett.plus.com escribió: Some time ago I discovered this difference between regular expressions in Python and Perl: Python \A matches at start of string \Z matches at end of string Perl \A matches at start of

Re: I'm a python addict !

2009-01-24 Thread Terry Reedy
Benjamin Kaplan wrote: On Sat, Jan 24, 2009 at 5:35 PM, Lie Ryan lie.1...@gmail.com mailto:lie.1...@gmail.com wrote: On Fri, 23 Jan 2009 19:58:09 -0700, Linuxguy123 wrote: I just started using python last week and I'm addicted. you need to try this: import antigravity

Re: why is this invalid b = a += b ?

2009-01-24 Thread MRAB
Stef Mientki wrote: hello, I can assign a value to more than 1 variable (name) in one line: a = b = 3 So evaluation of this line must start at the right part. But the following is not allowed: b = 2 a = b += 1 I would think that if b has a value, and the formula is evaluated from right to

Re: Regex for Python 2.7

2009-01-24 Thread MRAB
Gabriel Genellina wrote: En Sat, 24 Jan 2009 18:23:51 -0200, MRAB goo...@mrabarnett.plus.com escribió: Some time ago I discovered this difference between regular expressions in Python and Perl: Python \A matches at start of string \Z matches at end of string Perl \A

Re: I'm a python addict !

2009-01-24 Thread MRAB
Terry Reedy wrote: Benjamin Kaplan wrote: On Sat, Jan 24, 2009 at 5:35 PM, Lie Ryan lie.1...@gmail.com mailto:lie.1...@gmail.com wrote: On Fri, 23 Jan 2009 19:58:09 -0700, Linuxguy123 wrote: I just started using python last week and I'm addicted. you need to try this:

Re: Is (-1 ==True) True or False? Neither

2009-01-24 Thread Robert Kern
On 2009-01-24 17:00, oktaysa...@superonline.com wrote: Hi all, I ran into a strange case. Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 ... -1 == True False -1 == False False This works though: if -1: print OK OK After some head scratching, I

Re: I'm a python addict !

2009-01-24 Thread Robert Kern
On 2009-01-23 22:25, Aahz wrote: In articlemailman.7865.1232765899.3487.python-l...@python.org, Linuxguy123linuxguy...@gmail.com wrote: I just started using python last week and I'm addicted. Welcome! Just be aware that excessive Perl-bashing is considered somewhat tasteless on this

Re: Can webbrowser module get source code?

2009-01-24 Thread Benjamin Peterson
Muddy Coder cosmo_general at yahoo.com writes: I want to go further: to get the source code of the webpage being displayed. Is it possible to do it? I tried webbrow.get() but didn't work. Somebody can help? Thanks! To do this, you actually need to fetch the page yourself: import urllib2

Re: RegEx issues

2009-01-24 Thread John Machin
On Jan 25, 5:59 am, Scott David Daniels scott.dani...@acm.org wrote: Sean Brown wrote: I have the following string ...:  td[ct] = [[ ... ]];\r\n The ... (representing text in the string) is what I'm extracting So I think the regex \[\[(.*)\]\]; should do it. The problem is it appears

Re: why is this invalid b = a += b ?

2009-01-24 Thread Terry Reedy
Stef Mientki wrote: hello, I can assign a value to more than 1 variable (name) in one line: a = b = 3 So evaluation of this line must start at the right part. But the following is not allowed: b = 2 a = b += 1 This strikes me as slightly incoherent. Given that v op=exp is mostly that

Re: Possible to slice a string with unpacked tuple?

2009-01-24 Thread Benjamin Peterson
MRAB google at mrabarnett.plus.com writes: Does myString[myTuple[0] : myTuple[1]] count as unpacking? If it does, then how about myString.__getslice__(*myTuple)? Please don't use special method names directly and especially not __getslice__(). It's deprecated and will be removed. --

Re: Regex for Python 2.7

2009-01-24 Thread John Machin
On Jan 25, 7:23 am, MRAB goo...@mrabarnett.plus.com wrote: Some time ago I discovered this difference between regular expressions in Python and Perl: Python         \A matches at start of string         \Z matches at end of string Perl         \A matches at start of string         \Z

Re: Parsing a string into a datetime object

2009-01-24 Thread Mark.Petrovic
On Jan 24, 10:56 am, Hrvoje Niksic hnik...@xemacs.org wrote: Mark.Petrovic mspetro...@gmail.com writes: Might someone comment on why %f is not accepted as a valid field directive in: from datetime import datetime created=2009-01-24 16:04:55.882788 dt =

  1   2   >