Re: Best way to report progress at fixed intervals

2008-12-09 Thread Slaunger
On 10 Dec., 08:03, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Slaunger <[EMAIL PROTECTED]> writes: > > On 10 Dec., 03:44, George Sakkis <[EMAIL PROTECTED]> wrote: > >> On Dec 9, 11:40 am, Slaunger <[EMAIL PROTECTED]> wrote: > > >> > I would therefore like some feedback on this proposed generic "

Re: Accessing __slots__ from C

2008-12-09 Thread Mike Kolbet
-- http://mail.python.org/mailman/listinfo/python-list

Re: "as" keyword woes

2008-12-09 Thread Aaron Brady
On Dec 9, 4:53 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 09 Dec 2008 08:30:26 -0800, Aaron Brady wrote: > > The following are semantically equivalent: > > > I certainly wouldn't want something like PL/I, where "IF", "THEN" and > > "ELSE" could be identifiers. > > >

Re: Best way to report progress at fixed intervals

2008-12-09 Thread Arnaud Delobelle
Slaunger <[EMAIL PROTECTED]> writes: > On 10 Dec., 03:44, George Sakkis <[EMAIL PROTECTED]> wrote: >> On Dec 9, 11:40 am, Slaunger <[EMAIL PROTECTED]> wrote: >> >> > I would therefore like some feedback on this proposed generic "report >> > progress at regular intervals" approach presented here. W

Re: Best way to report progress at fixed intervals

2008-12-09 Thread Slaunger
On 10 Dec., 03:44, George Sakkis <[EMAIL PROTECTED]> wrote: > On Dec 9, 11:40 am, Slaunger <[EMAIL PROTECTED]> wrote: > > > I would therefore like some feedback on this proposed generic "report > > progress at regular intervals" approach presented here. What could I > > do better? > > There is a py

Re: "as" keyword woes

2008-12-09 Thread Aaron Brady
On Dec 9, 12:40 pm, MRAB <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > On Dec 9, 8:28 am, MRAB <[EMAIL PROTECTED]> wrote: > > snip > >> In some languages (I think Delphi is one of them - it's been a while!) > >> some words which would normally be identifiers have a special meaning in > >> cer

Re: Compiling and installing python 2.5.2 with Visual C++ 2008

2008-12-09 Thread Martin v. Löwis
> - > ... > error: Python was built with Visual Studio 2003; > extensions must be built with a compiler than can generate compatible > binaries. > Visual Studio 2003 was not found on this system. If you have Cygwin installed, > you can try co

Re: SequenceMatcher bug ?

2008-12-09 Thread eliben
On Dec 10, 4:12 am, [EMAIL PROTECTED] wrote: > On Mon, 8 Dec 2008 at 23:46, eliben wrote: > > 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.SequenceMatcherclass. > > Specifically, its ratio() method. The follo

Re: List Problem

2008-12-09 Thread Robert Lehmann
On Tue, 09 Dec 2008 21:40:08 -0800, dongzhi wrote: > I have one problem for List. Like that: > > format='just "a" ""little"" test' > part = format.split('"') > print part > > the result is : ['just ', 'a', ' ', '', 'little', '', ' test'] > > the list part have 7 element. > > If I execute part[

Re: List Problem

2008-12-09 Thread dongzhi
On Dec 10, 2:00 pm, "James Mills" <[EMAIL PROTECTED]> wrote: > On Wed, Dec 10, 2008 at 3:40 PM, dongzhi <[EMAIL PROTECTED]> wrote: > > If I execute part[1], I have got  'a'. If I execute part[2], I have > > got ' '. But, if I execute part[1::2], I have got ['a', '', '']. I > > don't know why. Pleas

Re: List Problem

2008-12-09 Thread James Mills
On Wed, Dec 10, 2008 at 3:40 PM, dongzhi <[EMAIL PROTECTED]> wrote: > If I execute part[1], I have got 'a'. If I execute part[2], I have > got ' '. But, if I execute part[1::2], I have got ['a', '', '']. I > don't know why. Please tell me why. Perhaps you meant: part[1:2] pydoc list This will

List Problem

2008-12-09 Thread dongzhi
Hi All, I have one problem for List. Like that: format='just "a" ""little"" test' part = format.split('"') print part the result is : ['just ', 'a', ' ', '', 'little', '', ' test'] the list part have 7 element. If I execute part[1], I have got 'a'. If I execute part[2], I have got ' '. But, i

Re: StringIO in 2.6 and beyond

2008-12-09 Thread ajaksu
On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]> wrote: > On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote: > > > In Python 2.x unmarked string literals are bytestrings. In Python 3.x > > they're Unicode. The intention is to make the transition from 2.x to 3.x > > easier by adding some features of

Re: Best way to report progress at fixed intervals

2008-12-09 Thread Jon Morton
I think there is something I've run into, and it will only ever get _loaded_ once. See below for sour output of an easy example case of my problem. The wxPython lib is big, so it may have bugs, but pySer l and pure python (no C/C++ directly, event thought it uses os.open/ close & termios that

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Xah Lee
Jon Harrop moron wrote: > Only for trivial input and not for the challenge you were given. what challenge? > That code is evaluated once to build the scene. There is no point in > optimizing it. The point is optimizing your incompetence. > That performance issue only affects trivial problems an

Re: Python & LEGO Mindstorm control...

2008-12-09 Thread Steve Holden
[EMAIL PROTECTED] wrote: > 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: You do

Re: what's so difficult about namespace?

2008-12-09 Thread Steve Holden
Xah Lee wrote: [...] > Steve Holden wrote: >> And therein lies the danger of imagination. > >> Typically the namespace components are looked up one by one, so for >> >>this.that.theother >> >> first "this" will be looked up and (hopefully) yield an object with a >> namespace, which will then b

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 22:57:36 -0500, Albert Hopkins wrote: > On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote: [...] >> > So is there a way to find the offending code w/o having to go >> through >> > every line of code in 'foo' by hand? >> >> Just search for "del x" in your code. Your edit

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote: [...] > > So is there a way to find the offending code w/o having to go > through > > every line of code in 'foo' by hand? > > Just search for "del x" in your code. Your editor does have a search > function, surely? > > Well, you'd th

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread excord80
On Dec 9, 10:29 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Tue, Dec 9, 2008 at 7:16 PM,  <[EMAIL PROTECTED]> wrote: > > On Dec 9, 10:04 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > >> So, why do you think apt and not setuptools is The Right Way(tm)? > > > I like to keep > 1 Python on my

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread Chris Rebert
On Tue, Dec 9, 2008 at 7:16 PM, <[EMAIL PROTECTED]> wrote: > On Dec 9, 10:04 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: >> So, why do you think apt and not setuptools is The Right Way(tm)? > > I like to keep > 1 Python on my computer. Ah, now I get it. I had no idea setuptools could install Py

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread excord80
On Dec 9, 10:15 pm, [EMAIL PROTECTED] wrote: > On Tue, 9 Dec 2008 at 18:49, [EMAIL PROTECTED] wrote: > > On Ubuntu, I accidentally manually installed setuptools > >http://pypi.python.org/pypi/setuptools/0.6c9(by running the .egg file > > as a shell script via sudo), and now realize I should just be

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread excord80
On Dec 9, 10:04 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > So, why do you think apt and not setuptools is The Right Way(tm)? I like to keep > 1 Python on my computer. 1. First, there's the system Python, which is installed by my OS and which I try not to mess with too much. I'm guessing Ubun

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 18:49, [EMAIL PROTECTED] wrote: On Ubuntu, I accidentally manually installed setuptools http://pypi.python.org/pypi/setuptools/0.6c9 (by running the .egg file as a shell script via sudo), and now realize I should just be using apt to take care of my system Python packages. I

Re: Text parsing via regex

2008-12-09 Thread rdmurray
On Mon, 8 Dec 2008 at 16:51, Robert Kern wrote: 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 anythin

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread Chris Rebert
On Tue, Dec 9, 2008 at 6:49 PM, <[EMAIL PROTECTED]> wrote: > On Ubuntu, I accidentally manually installed setuptools > http://pypi.python.org/pypi/setuptools/0.6c9 (by running the .egg file > as a shell script via sudo), and now realize I should just be using > apt to take care of my system Python

How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread excord80
On Ubuntu, I accidentally manually installed setuptools http://pypi.python.org/pypi/setuptools/0.6c9 (by running the .egg file as a shell script via sudo), and now realize I should just be using apt to take care of my system Python packages. I also installed one or two packages using its ``easy_ins

Re: Mathematica 7 compares to other languages

2008-12-09 Thread sln
On Tue, 9 Dec 2008 15:01:11 -0800 (PST), Xah Lee <[EMAIL PROTECTED]> wrote: > >On Dec 8, 4:56 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: >> 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 chal

Re: Best way to report progress at fixed intervals

2008-12-09 Thread George Sakkis
On Dec 9, 11:40 am, Slaunger <[EMAIL PROTECTED]> wrote: > I would therefore like some feedback on this proposed generic "report > progress at regular intervals" approach presented here. What could I > do better? There is a pypi package that might do what you're looking for (haven't used it though

Re: Test posting #2 - please ignore

2008-12-09 Thread Skip Montanaro
Still testing (posted via google groups)... S -- http://mail.python.org/mailman/listinfo/python-list

Re: SequenceMatcher bug ?

2008-12-09 Thread rdmurray
On Mon, 8 Dec 2008 at 23:46, eliben wrote: 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] * 5

Re: Mathematica 7 compares to other languages

2008-12-09 Thread sln
On Tue, 9 Dec 2008 15:19:47 -0800 (PST), Xah Lee <[EMAIL PROTECTED]> wrote: >On Dec 8, 4:07 am, Jon Harrop <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> > Well, its past 'tonight' and 6 hours to go till past 'tomorrow'. >> > Where the hell is it Zah Zah? >> >> Note that this program ta

Re: Test posting #2 - please ignore

2008-12-09 Thread Skip Montanaro
On Dec 9, 3:40 pm, Skip Montanaro <[EMAIL PROTECTED]> wrote: > This is another posting you can ignore.  This time posted > via Google Groups. Test #3. Still fiddling around... Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Test message - please ignore

2008-12-09 Thread Skip Montanaro
Skip Montanaro pobox.com> writes: > > Testing a new news-to-mail gateway on mail.python.org. > This post is from gmane. Please ignore. Test #4. Another one to ignore... S -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Jon Harrop
Xah Lee wrote: > On Dec 8, 5:25 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: >> Lest anyone doubt that problem size is important for comparing program >> run times, consider ... > > just in case there's any doubt: > > Simply change these lines in Jon's program: > > Main[9, 512, 4] to Main[9, 512,

Re: Compiling and installing python 2.5.2 with Visual C++ 2008

2008-12-09 Thread Juan Pablo Romero Méndez
Thanks! I'm having trouble with msi.py, so I'll better try python 2.6 The problem is with Pivy (openinventor bindings to python), it refuses to compile. It says: - ... error: Python was built with Visual Studio 2003; extensions must be buil

forcing future re-import from with an imported module

2008-12-09 Thread _wolf
following problem: i have a module importer_1 that first imports importer_2, then importee. importer_2 also imports importee. as we all know, follow-up imports are dealt out from the cache by python’s import mechanism, meaning the importee file gets only cached once. i can force module-level code i

Re: Rich Comparisons Gotcha

2008-12-09 Thread Rhodri James
On Mon, 08 Dec 2008 14:24:59 -, Rasmus Fogh <[EMAIL PROTECTED]> wrote: On the minus side there would be the difference between '__equal__' and '__eq__' to confuse people. This is a very big minus. It would be far better to spell __equal__ in such a way as to make it clear why it wasn'

Re: How to initialize a class variable once

2008-12-09 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Joe Strout <[EMAIL PROTECTED]> wrote: > On Dec 9, 2008, at 4:31 AM, Brian Allen Vanderburg II wrote: > > > There is one situation where a module can be imported/executed > > twice, if it is the __main__ module. > Anyway, thanks for pointing this out; I bet it's

Re: Mathematica 7 compares to other languages

2008-12-09 Thread alex23
On Dec 10, 9:19 am, Xah Lee <[EMAIL PROTECTED]> wrote: > I'm not sure he's intentionally making Mathematica look bad or just > sloppiness. Actually, there's only one person here tainting Mathematica by association, and it's not Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: fuzzy or boolean text search

2008-12-09 Thread morecowbell
On Dec 9, 12:14 am, John Machin <[EMAIL PROTECTED]> wrote: > 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 :) ?

Re: Best way to report progress at fixed intervals

2008-12-09 Thread Slaunger
On 10 Dec., 00:11, [EMAIL PROTECTED] wrote: > >>          # Monitoring loop. > >>          loops = 0 > >>          # We're going to loop ten times per second using an integer count, > >>          # so multiply the seconds parameter by 10 to give it the same > >>          # magnitude. > >>          

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Xah Lee
On Dec 8, 4:07 am, Jon Harrop <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Well, its past 'tonight' and 6 hours to go till past 'tomorrow'. > > Where the hell is it Zah Zah? > > Note that this program takes several days to compute in Mathematica (even > though it takes under four secon

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Xah Lee
On Dec 8, 5:25 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Lest anyone doubt that problem size is important for comparing program > run times, consider ... just in case there's any doubt: Simply change these lines in Jon's program: Main[9, 512, 4] to Main[9, 512, 4.] and it will run faster. A

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Xah Lee
On Dec 8, 4:56 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: > 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 >

Re: "as" keyword woes

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 05:48:29 -0800, Paul Boddie wrote: > Well, I think it's more interesting to explore the boundaries of what > can be done, to debunk notions that such things aren't being done in the > mainstream, and to examine whether they could benefit usability, than it > is to defer to the

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Xah Lee
On Dec 8, 4:56 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: > 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 >

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 13:11:40 -0500, Albert Hopkins wrote: > The difference is under Python 2.4 I get a traceback with the lineno and > offending line, but I do not get a traceback in Pythons 2.6 and 3.0. If tracebacks are broken, surely that would be a pretty huge bug. It seems to be broken in 2

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Marc 'BlackJack' Rintsch
On Tue, 09 Dec 2008 20:56:19 +, Lie Ryan wrote: > Interestingly, many linux _distro_ also inhibit this quick version > number change. Fedora 10, Ubuntu is 2 years old, version 8 (they start > from version 6 not 1). Ubuntu's version numbers don't follow the usual rules but are year and month

Re: "as" keyword woes

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 08:30:26 -0800, Aaron Brady wrote: > The following are semantically equivalent: > > I certainly wouldn't want something like PL/I, where "IF", "THEN" and > "ELSE" could be identifiers. > > I wouldn't want something like PL/I, where "IF", "THEN" and "ELSE" could > be identifie

EURASIP JASP - Special issue on Image Processing and Analysis in Biomechanics - Announce & Call for papers

2008-12-09 Thread tava...@fe.up.pt
-- (Apologies for cross-posting) EURASIP Journal on Advances in Signal Processing Special issue on Image Processing and Analysis in Biomechanics http://www.hinda

Re: Google Summer of Code 2009

2008-12-09 Thread Martin v. Löwis
> 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 decen

Test posting #2 - please ignore

2008-12-09 Thread Skip Montanaro
This is another posting you can ignore. This time posted via Google Groups. Skip Montanaro -- http://mail.python.org/mailman/listinfo/python-list

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

2008-12-09 Thread Ethan Furman
Lawrence D'Oliveiro wrote: for \ Entry \ in \ sorted \ ( f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) != None ) \ : Patch = (open, gzip.GzipFile)[Entry.endswith(".gz")](os.path.join(PatchesDir, Entry), "r") ... read from

Re: Best way to report progress at fixed intervals

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 13:27, Slaunger wrote: On 9 Dec., 19:35, [EMAIL PROTECTED] wrote: I felt like a little lunchtime challenge, so I wrote something that I think matches your spec, based on your sample code. ?This is not necessarily the best implementation, but I think it is simpler and clear

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Benjamin Kaplan
On Tue, Dec 9, 2008 at 3:56 PM, Lie Ryan <[EMAIL PROTECTED]> wrote: > On Sun, 07 Dec 2008 21:48:46 +, Tim Rowe wrote: > > > 2008/12/7 walterbyrd <[EMAIL PROTECTED]>: > >> IMO: breaking backward compatibility is a big deal, and should only be > >> done when it is seriously needed. > >> > >> Als

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Lie Ryan
On Tue, 09 Dec 2008 16:10:08 -0500, Albert Hopkins wrote: > On Tue, 2008-12-09 at 20:56 +, Lie Ryan wrote: >> Actually I noticed a tendency from open-source projects to have slow >> increment of version number, while proprietary projects usually have >> big >> version numbers. >> >> Linux 2.x

Test message - please ignore

2008-12-09 Thread Skip Montanaro
Testing a new news-to-mail gateway on mail.python.org. This post is from gmane. Please ignore. Thx, Skip Montanaro -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to report progress at fixed intervals

2008-12-09 Thread Slaunger
On 9 Dec., 19:35, [EMAIL PROTECTED] wrote: > > I felt like a little lunchtime challenge, so I wrote something that > I think matches your spec, based on your sample code.  This is not > necessarily the best implementation, but I think it is simpler and > clearer than yours.  The biggest change is t

Re: Guido's new method definition idea

2008-12-09 Thread Lie Ryan
On Mon, 08 Dec 2008 20:55:16 +, Arnaud Delobelle 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): >>

Re: "as" keyword woes

2008-12-09 Thread Mel
Carl Banks wrote: >[ ... ] Do you want the human reader to have to have all kinds of > rules to memorize about when a symbol is an identifier and when it's a > syntactic element? Do you want people to have to learn when to escape > a symbol so that the parser treats it as an identifier instead of

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 20:56 +, Lie Ryan wrote: > Actually I noticed a tendency from open-source projects to have slow > increment of version number, while proprietary projects usually have > big > version numbers. > > Linux 2.x: 1991 Python 3.x.x: 1991. Apache 2.0: 1995. OpenOffice.org > 3.0

conratulations.......

2008-12-09 Thread john adam
conratulatios.. Here's my dear friend largest mobile library programs All you care programs : Witness all the programs in the modern world Alkmiotr Honored by your visit You'll see in the blogger 1.If you are suffering from a virus protection programs most important to you AVG Anti-Virus Free

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Lie Ryan
On Sun, 07 Dec 2008 21:48:46 +, Tim Rowe wrote: > 2008/12/7 walterbyrd <[EMAIL PROTECTED]>: >> IMO: breaking backward compatibility is a big deal, and should only be >> done when it is seriously needed. >> >> Also, IMO, most of, if not all, of the changes being made in 3.0 are >> debatable, at

Re: When (and why) to use del?

2008-12-09 Thread Bruno Desthuilliers
malkarouri a écrit : (snip) The del statement doesn't actually free memory. It just removes the binding from the corresponding namespace. So in your first example, my_string cannot be used after the deletion. Of course, if the string referenced by my_string was referenced by some other name then

Re: Beginner trying to understand functions.

2008-12-09 Thread Arnaud Delobelle
Ivan Illarionov <[EMAIL PROTECTED]> writes: > On Dec 8, 9:02 pm, simonh <[EMAIL PROTECTED]> wrote: >> Thanks for the many replies. Thanks especially to Pierre. This works >> perfectly: > > > >> def getAge(): >>     while True: >>         try: >>             age = int(input('Please enter your age:

Re: When (and why) to use del?

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 18:55, Duncan Booth wrote: Albert Hopkins <[EMAIL PROTECTED]> wrote: def otherfunction(): try: # some stuff except SomeException, e: # more stuff del e return I think this looks u

Re: pickling a circular object inherited from list

2008-12-09 Thread Ned Deily
In article <[EMAIL PROTECTED]>, Klaus Kopec <[EMAIL PROTECTED]> wrote: > >> What did I do wrong? > > Old Python version? :) > > Seems to work in 3.0 (don't have 2.6 currently to check but IMO it's > > fixed there as well). > It works for me with v3.0 as well, but not with v2.6.1 (same error as >

Re: Rich Comparisons Gotcha

2008-12-09 Thread Rhamphoryncus
You grossly overvalue using the "in" operator on lists. It's far more common to use a dict or set for containment tests, due to O(1) performance rather than O(n). I doubt the numpy array supports hashing, so an error for misuse is all you should expect. In the rare case that you want to test for

Re: StringIO in 2.6 and beyond

2008-12-09 Thread Peter Otten
Bill McClain wrote: > On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote: > >> >>> out = io.StringIO() >> >>> print(u"hello", file=out, end=u"\n") >> >>> out.getvalue() >> u'hello\n' > > That has the benefit of working. Thank you! > > That can't be the intended behavior of print(), can it? In

Re: StringIO in 2.6 and beyond

2008-12-09 Thread Bill McClain
On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote: > In Python 2.x unmarked string literals are bytestrings. In Python 3.x > they're Unicode. The intention is to make the transition from 2.x to 3.x > easier by adding some features of 3.x to 2.x, but without breaking > backwards compatibility (not e

Re: Rich Comparisons Gotcha

2008-12-09 Thread Rasmus Fogh
Mark Dickinson wrote: > On Dec 8, 2:24 pm, Rasmus Fogh <[EMAIL PROTECTED]> wrote: >> So, I would much prefer a language change. I am not competent to even >> propose one properly, but I'll try. > I don't see any technical problems in what you propose: as > far as I can see it's entirely feasibl

Spring Python 0 .9.1 has been released

2008-12-09 Thread Goldfish
I just released Spring Python 0.9.1. One of our users spotted an error in the http://springpython.webfactional.com/reference/html/ objects.html">IoC container involving constructor arguments, and I was able to reproduce the problem, patch it, and get it released quickly to the user community. You c

Re: StringIO in 2.6 and beyond

2008-12-09 Thread MRAB
Bill McClain wrote: On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote: out = io.StringIO() print(u"hello", file=out, end=u"\n") out.getvalue() u'hello\n' That has the benefit of working. Thank you! That can't be the intended behavior of print(), can it? Insering non-unicode spaces and li

Re: When (and why) to use del?

2008-12-09 Thread Duncan Booth
Albert Hopkins <[EMAIL PROTECTED]> wrote: > def otherfunction(): > try: > # some stuff > except SomeException, e: > # more stuff > del e > return > > > I think this looks ugly, but also does it not hurt p

Re: Best way to report progress at fixed intervals

2008-12-09 Thread MRAB
Slaunger wrote: Hi comp.lang.python I am a novice Python 2.5 programmer, who write some cmd line scripts for processing large amounts of data. I would like to have possibility to regularly print out the progress made during the processing, say every 1 seconds, and i am wondering what a proper g

Re: StringIO in 2.6 and beyond

2008-12-09 Thread Bill McClain
On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote: > >>> out = io.StringIO() > >>> print(u"hello", file=out, end=u"\n") > >>> out.getvalue() > u'hello\n' That has the benefit of working. Thank you! That can't be the intended behavior of print(), can it? Insering non-unicode spaces and line te

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 13:11, Albert Hopkins wrote: Say I have module foo.py: def a(x): def b(): x del x [...] The difference is under Python 2.4 I get a traceback with the lineno and offending line, but I do not get a traceback in Pythons 2.6 and 3.0.

Re: "as" keyword woes

2008-12-09 Thread MRAB
Aaron Brady wrote: On Dec 9, 8:28 am, MRAB <[EMAIL PROTECTED]> wrote: snip In some languages (I think Delphi is one of them - it's been a while!) some words which would normally be identifiers have a special meaning in certain contexts, but the syntax precludes any ambiguity, and not in a diffic

Re: "as" keyword woes

2008-12-09 Thread Chris Mellon
On Tue, Dec 9, 2008 at 6:39 AM, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 9 Des, 05:52, alex23 <[EMAIL PROTECTED]> wrote: >> >> From my perspective, it was less the original complaint and more the >> sudden jump to "CPython is dead! The GIL sucks! Academic eggheads!" >> that prompted the comparis

Re: Best way to report progress at fixed intervals

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 08:40, Slaunger wrote: I am a novice Python 2.5 programmer, who write some cmd line scripts for processing large amounts of data. I would like to have possibility to regularly print out the progress made during the processing, say every 1 seconds, and i am wondering what a

Re: RuntimeError: dictionary changed size during iteration

2008-12-09 Thread Terry Reedy
Robert Dailey wrote: When I do: for key in stuff.keys(): It works! I wonder why .keys() makes a difference. It is using a 'view', which is a new concept in Python 3.0 that I'm not totally familiar with yet. Because stuff.keys() is evaluated *once* and the result is a separate object from s

Re: "as" keyword woes

2008-12-09 Thread Carl Banks
On Dec 9, 7:48 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 9 Des, 14:24, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > > That is not what Guido said. What he actually said was: > > > "That's possible with sufficiently powerful parser technology, but > > that's not how th

Re: Python 3 For Python 2 Users

2008-12-09 Thread Terry Reedy
Tim Daneliuk wrote: I code in Python 2.x intermittently and have only casually watched the 3.x development discussions. Now it's time to get up to speed. Has someone written a tutorial for people in my situation. Yes, I've looked at the release notes, but I'm looking for something that motivate

Re: memory leak?

2008-12-09 Thread Terry Reedy
Gabriel Rossetti wrote: I ran these tests on linux 2.6 (ubuntu 8.04) using python 2.5.2. Have you tried the much newer 2.6? 2.5.3 will be out soon with some bug fixes. -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling a circular object inherited from list

2008-12-09 Thread Klaus Kopec
What did I do wrong? Old Python version? :) Seems to work in 3.0 (don't have 2.6 currently to check but IMO it's fixed there as well). It works for me with v3.0 as well, but not with v2.6.1 (same error as stated before for v2.4). Is there any way to fix this in v2.6.1 or even v2.4? Right now I

Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Albert Hopkins
Say I have module foo.py: def a(x): def b(): x del x If I run foo.py under Python 2.4.4 I get: File "foo.py", line 4 del x SyntaxError: can not delete variable 'x' referenced in nested scope Under Python

Re: StringIO in 2.6 and beyond

2008-12-09 Thread Peter Otten
Bill McClain wrote: > I've just installed 2.6, had been using 2.4. > > This was working for me: > > #! /usr/bin/env python > import StringIO > out = StringIO.StringIO() > print >> out, 'hello' > > I used 2to3, and added import from future to get: > > #! /usr/bin/env python

memory leak?

2008-12-09 Thread Gabriel Rossetti
I have been debugging a distributed application for about 2 days that has a memory leak. My app is a Twisted app, so I thought that maybe it was on the twisted side, I finally isolated it to no being a Twisted problem but a Python problem. The problem comes from the code that uses wxPython and

Re: When (and why) to use del?

2008-12-09 Thread Philip Semanchuk
On Dec 9, 2008, at 11:35 AM, Albert Hopkins wrote: I'm looking at a person's code and I see a lot of stuff like this: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string del my_stri

Re: Python 3 For Python 2 Users

2008-12-09 Thread pruebauno
On Dec 9, 11:58 am, Tim Daneliuk <[EMAIL PROTECTED]> wrote: > I code in Python 2.x intermittently and have only casually watched the > 3.x development discussions.  Now it's time to get up to speed. > Has someone written a tutorial for people in my situation.  Yes, I've > looked at the release note

Re: When (and why) to use del?

2008-12-09 Thread pruebauno
On Dec 9, 11:35 am, Albert Hopkins <[EMAIL PROTECTED]> wrote: > I'm looking at a person's code and I see a lot of stuff like this: > >         def myfunction(): >             # do some stuff stuff >             my_string = function_that_returns_string() >             # do some stuff with my_string

Python 3 For Python 2 Users

2008-12-09 Thread Tim Daneliuk
I code in Python 2.x intermittently and have only casually watched the 3.x development discussions. Now it's time to get up to speed. Has someone written a tutorial for people in my situation. Yes, I've looked at the release notes, but I'm looking for something that motivates all the major change

Re: When (and why) to use del?

2008-12-09 Thread malkarouri
On 9 Dec, 16:35, Albert Hopkins <[EMAIL PROTECTED]> wrote: > I'm looking at a person's code and I see a lot of stuff like this: > >         def myfunction(): >             # do some stuff stuff >             my_string = function_that_returns_string() >             # do some stuff with my_string >  

Re: "as" keyword woes

2008-12-09 Thread George Sakkis
On Dec 9, 9:28 am, MRAB <[EMAIL PROTECTED]> wrote: > I certainly wouldn't want something like PL/I, where "IF", "THEN" and > "ELSE" could be identifiers, so you could have code like: > >      IF IF = THEN THEN >          THEN = ELSE; >      ELSE >          ELSE = IF; Although I agree with the sen

Re: StringIO in 2.6 and beyond

2008-12-09 Thread Bill McClain
On 2008-12-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > This puzzles me too. According to the documentation StringIO accepts > both byte strings and unicode strings. Try to replace >output.write('First line.\n') > with >output.write(unicode('First line.\n')) > or >output.write(st

Re: When (and why) to use del?

2008-12-09 Thread Slaunger
On 9 Dec., 17:35, Albert Hopkins <[EMAIL PROTECTED]> wrote: > I'm looking at a person's code and I see a lot of stuff like this: > >         def myfunction(): >             # do some stuff stuff >             my_string = function_that_returns_string() >             # do some stuff with my_string >

Best way to report progress at fixed intervals

2008-12-09 Thread Slaunger
Hi comp.lang.python I am a novice Python 2.5 programmer, who write some cmd line scripts for processing large amounts of data. I would like to have possibility to regularly print out the progress made during the processing, say every 1 seconds, and i am wondering what a proper generic way to do t

Re: pickling a circular object inherited from list

2008-12-09 Thread Miki
Hello Klaus, > I have a problem with inheritance from list. I want to create a tree > like object where child nodes are kept in self[:] and every child has a > field that points to its parent. Pickling such an object, however, > throws an AssertionError. See below for source code and output of an

Re: StringIO in 2.6 and beyond

2008-12-09 Thread pruebauno
On Dec 9, 11:28 am, Bill McClain <[EMAIL PROTECTED]> wrote: > On 2008-12-08, Bill McClain <[EMAIL PROTECTED]> wrote: > > > 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

  1   2   >