ANN ChiPy December Meeting Thursday the 11th at ThoughtWork, pls RSVP

2008-12-09 Thread Brian Ray
Chicago Python User Group = Calling all Chicago Python Ninja's, this will be our best meeting yet-- this Thursday. (if not, there will be some pretty darn good pizza in here) Insert funny comic here: http://tinyurl.com/6b2oln We have some interesting dragon slaying

Re: Password input in console/terminal

2008-12-09 Thread cadmuxe
On 12月9日, 下午2时01分, Chris Rebert [EMAIL PROTECTED] wrote: 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

Re: html codes

2008-12-09 Thread Matt Nordhoff
Daniel Fetchinson wrote: 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

Re: html codes

2008-12-09 Thread Peter Otten
Daniel Fetchinson wrote: 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

Re: gzip.GzipFile (was Re: Don't you just love writing this sort of thing :))

2008-12-09 Thread Jorgen Grahn
On Mon, 08 Dec 2008 14:21:40 +, MRAB [EMAIL PROTECTED] wrote: Jorgen Grahn wrote: On Sat, 06 Dec 2008 10:01:10 +, Arnaud Delobelle [EMAIL PROTECTED] wrote: ... Why use (open, gzp.GzipFile)[Entry.endswith(.gz)] when we have had contitional expressions for a few years now? Instead,

Re: Announcement: MindTree for Python beta -- feedback appreciated

2008-12-09 Thread Johann Spies
The MindTree project can be found and downloaded here: http://code.google.com/p/mindtree/ I suppose it might be a python3-problem: % /usr/local/bin/python3.0 MindTree.pyw Traceback (most recent call last): File MindTree.pyw, line 2, in module from future_builtins import *

Re: ORB for Python and PHP

2008-12-09 Thread Laszlo Nagy
There are others but they do not support both Python and PHP. Should I implement my own ORB, or do you know a suitable solution? The whole purpose of an ORB ist that it is interoperable. So if you have a good python orb (I personally prefer OmniORB), and a good one for PHP - connect

Re: ORB for Python and PHP

2008-12-09 Thread Diez B. Roggisch
Laszlo Nagy schrieb: There are others but they do not support both Python and PHP. Should I implement my own ORB, or do you know a suitable solution? The whole purpose of an ORB ist that it is interoperable. So if you have a good python orb (I personally prefer OmniORB), and a good one

Re: Guido's new method definition idea

2008-12-09 Thread Aaron Brady
On Dec 8, 6:43 pm, william tanksley [EMAIL PROTECTED] wrote: 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? snip I see a lot of people are against it; I admit that it's not

Re: Beginner trying to understand functions.

2008-12-09 Thread Bruno Desthuilliers
simonh a écrit : Thanks for the many replies. Thanks especially to Pierre. This works perfectly: (snip) Ok, now for some algorithmic stuff: def checkAge(age,min=18,max=31): if age in list(range(min, max)): print('Come on in!') elif age min: print('Sorry, too

Re: Guido's new method definition idea

2008-12-09 Thread Bruno Desthuilliers
william tanksley a écrit : 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

Re: Catching Python exceptions in C

2008-12-09 Thread Ivan Illarionov
On Dec 8, 9: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 following

Re: Catching Python exceptions in C

2008-12-09 Thread Ivan Illarionov
On Dec 9, 12:33 pm, Ivan Illarionov [EMAIL PROTECTED] wrote: On Dec 8, 9: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.

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

2008-12-09 Thread Cong Ma
Gabriel Genellina wrote: 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

Re: python3.0 - any hope it will get faster?

2008-12-09 Thread Kay Schluehr
On 9 Dez., 11:51, Helmut Jarausch [EMAIL PROTECTED] wrote: Hi, I was somewhat surprised when I ran pystones with python-2.5.2 and with python-3.0 On my old/slow machine I get python-2.5.2 from test import pystone pystone.pystones() gives (2.73, 18315.018315018315) python-3.0 from

Re: Guido's new method definition idea

2008-12-09 Thread Antoine De Groote
[EMAIL PROTECTED] wrote: On Dec 6, 4:15 pm, Carl Banks [EMAIL PROTECTED] wrote: [...] This brings up another question, what would one use when referencing method names inside the class definition?: class C: def self.method(arg): self.value = arg def

primera

2008-12-09 Thread Antoine De Groote
zalli, du spills jo net mat am volley oder? mengs de du kinns dann mat mengem auto an den MCM an eventuell op sandweiler fueren? well méindes ass volley, densdes fussball, an mettwochs ass schon hellejen owend... nuecht antoine -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python now coming from Perl

2008-12-09 Thread Nick Craig-Wood
Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Nick Craig-Wood [EMAIL PROTECTED] wrote: My favourite mistake when I made the transition was calling methods without parentheses. In perl it is common to call methods without parentheses - in python this does

Re: as keyword woes

2008-12-09 Thread Paul Boddie
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 comparisons to trolling. To be fair to the complainant, before mentioning the GIL, he did

Re: as keyword woes

2008-12-09 Thread BJörn Lindqvist
2008/12/4 Chris Mellon [EMAIL PROTECTED]: Aside from the cultural indoctrination, though (and that may be a real and strong force when dealing with math software, and I don't want to discount it in general, just for purposes of this discussion) why is it more sensible to use x here instead of

Re: how to get a beep, OS independent ?

2008-12-09 Thread Duncan Booth
greg [EMAIL PROTECTED] wrote: 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

Re: as keyword woes

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 04:39:55 -0800, Paul Boddie wrote: To be fair to the complainant, before mentioning the GIL, he did initially get the usual trite fragments of the Zen of Python right back at him (simple is better than complex, special cases aren't special enough to break the rules),

Compiling and installing python 2.5.2 with Visual C++ 2008

2008-12-09 Thread Juan Pablo Romero Méndez
Hello all, I need to compile python myself because of a module (pivy). So I downloaded MS Visual C++ 2008 express edition. It apparently compiled fine but I don't know how to install it to recreate the standard distribution. In linux i'd take make install, but on windows? Regards, Juan Pablo

Re: Learning Python now coming from Perl

2008-12-09 Thread Roy Smith
Nick Craig-Wood [EMAIL PROTECTED] wrote: On the other hand, leaving out the parens returns the function itself, which you can then call later. I've often used this to create data-driven logic. I didn't say it wasn't useful, just that if you came from Perl like I did, it is an easy

Re: as keyword woes

2008-12-09 Thread Paul Boddie
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 the Python parser (and most parsers, in my experience) treat reserved words.

Re: Beginner trying to understand functions.

2008-12-09 Thread Bruno Desthuilliers
simonh a écrit : Thanks for the extra tips Ivan and Bruno. Here is how the program looks now. Any problems? import sys def get_name(): name = input('Please enter your name: ') print('Hello', name) This one would be better spelled get_and_display_name !-) def get_age():

Re: Beginner trying to understand functions.

2008-12-09 Thread Cedric Schmeits
the following would be nicer: def run(): get_name() a = get_age() check_age(a) again() if __name__ == __main__: run() In this setup your script will only be run if it's started by itself, but when using a import, the functions from the script can be executed separately. --

Re: python3.0 - any hope it will get faster?

2008-12-09 Thread Christian Heimes
Helmut Jarausch wrote: I know that processing unicode is inherently slower, but still I was surprised that it's so much slower. Is there any hope Python-3.0 will get faster or is the main potential for optimizations exhausted, already? That's not to start a flame war! I know computers get

Re: Rich Comparisons Gotcha

2008-12-09 Thread Rasmus Fogh
Steven DAprano wrote: 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:

Re: Beginner trying to understand functions.

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

Re: Google Summer of Code 2009

2008-12-09 Thread André
On Dec 8, 10:34 pm, Eric [EMAIL PROTECTED] wrote: 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

Re: How to initialize a class variable once

2008-12-09 Thread Brian Allen Vanderburg II
[EMAIL PROTECTED] wrote: Unless you are calling reload() on the module, it will only ever get _loaded_ once. Each additional import will just yield the existing module. Perhaps if you post an example of the behavior that leads you to believe that the class variables are getting reinitialized I

Re: Rich Comparisons Gotcha

2008-12-09 Thread Rasmus Fogh
Steven DAprano wrote: On Mon, 08 Dec 2008 14:24:59 +, Rasmus Fogh wrote: snip What might be a sensible behaviour (unlike your proposed wrapper) Sorry 1) I was rude, 2) I thanked TJR for your wrapper class proposal in a later mail. It is yours. What do you dislike about my wrapper class?

Re: close has no effect on Mac OSX Python 3.0

2008-12-09 Thread resi147
On 9 Dez., 07:51, Gabriel Genellina [EMAIL PROTECTED] wrote: 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='')

Re: Rich Comparisons Gotcha

2008-12-09 Thread Mark Dickinson
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 feasible. However: should. On the

python3.0 - any hope it will get faster?

2008-12-09 Thread Helmut Jarausch
Hi, I was somewhat surprised when I ran pystones with python-2.5.2 and with python-3.0 On my old/slow machine I get python-2.5.2 from test import pystone pystone.pystones() gives (2.73, 18315.018315018315) python-3.0 from test import pystone pystone.pystones() gives (4.2705,

Re: Beginner trying to understand functions.

2008-12-09 Thread simonh
Thanks for the extra tips Ivan and Bruno. Here is how the program looks now. Any problems? import sys def get_name(): name = input('Please enter your name: ') print('Hello', name) def get_age(): try: return int(input('Please enter your age: ')) except

our real femme

2008-12-09 Thread delmararlee
Some of our real femme http://wesexy.byethost8.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: primera

2008-12-09 Thread Antoine De Groote
Oops, sorry, this message was not intended for the group. Apologies Antoine De Groote wrote: zalli, du spills jo net mat am volley oder? mengs de du kinns dann mat mengem auto an den MCM an eventuell op sandweiler fueren? well méindes ass volley, densdes fussball, an mettwochs ass schon

Re: as keyword woes

2008-12-09 Thread MRAB
Paul Boddie 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 the Python parser (and most parsers, in my experience) treat

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

2008-12-09 Thread Gabriel Genellina
En Tue, 09 Dec 2008 11:32:46 -0200, Juan Pablo Romero Méndez [EMAIL PROTECTED] escribió: I need to compile python myself because of a module (pivy). So I downloaded MS Visual C++ 2008 express edition. It apparently compiled fine but I don't know how to install it to recreate the standard

Re: Guido's new method definition idea

2008-12-09 Thread ptn
On Dec 6, 10:15 am, Russ P. [EMAIL PROTECTED] wrote: On Dec 6, 4:32 am, Andreas Waldenburger [EMAIL PROTECTED] wrote: On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: class C:     def $method(arg):         $value = arg (Note there's no point after $, it's not

Re: Learning Python now coming from Perl

2008-12-09 Thread J. Cliff Dyer
On Sun, 2008-12-07 at 11:05 +0900, Bertilo Wennergren wrote: Aahz wrote: In article [EMAIL PROTECTED], Bertilo Wennergren [EMAIL PROTECTED] wrote: I don't suppose there is any introductory material out there that is based on Python 3000 and that is also geared at people with a

Re: dBase III files and Visual Foxpro 6 files

2008-12-09 Thread imageguy
On Dec 8, 2:53 am, Ethan Furman [EMAIL PROTECTED] wrote: Greetings All! I nearly have support complete for dBase III dbf/dbt files -- just wrapping up support for dates.  The null value has been a hindrance for awhile but I nearly have that solved as well. For any who know of a cool dbf

Re: RuntimeError: dictionary changed size during iteration

2008-12-09 Thread Robert Dailey
On Dec 8, 10:27 pm, John Machin [EMAIL PROTECTED] wrote: 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

'pretty print' for built in types

2008-12-09 Thread Robert Dailey
Hi, Is there a built in way to 'pretty print' a dict, list, and tuple (Amongst other types)? Dicts probably print the ugliest of them all, and it would be nice to see a way to print them in a readable way. I can come up with my own function to do this, but I don't want to do this if I don't have

Re: How to initialize a class variable once

2008-12-09 Thread Joe Strout
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. That's an excellent point -- this is something I've run into, and it always feels a bit awkward to code around it. What's the

Re: 'pretty print' for built in types

2008-12-09 Thread eric
On Dec 9, 4:31 pm, Robert Dailey [EMAIL PROTECTED] wrote: Hi, Is there a built in way to 'pretty print' a dict, list, and tuple (Amongst other types)? Dicts probably print the ugliest of them all, and it would be nice to see a way to print them in a readable way. I can come up with my own

Re: 'pretty print' for built in types

2008-12-09 Thread aspersieman
On Tue, 09 Dec 2008 17:31:41 +0200, Robert Dailey [EMAIL PROTECTED] wrote: Is there a built in way to 'pretty print' a dict, list, and tuple (Amongst other types)? Dicts probably print the ugliest of them all, and it would be nice to see a way to print them in a readable way. I can come up

Re: how to get a beep, OS independent ?

2008-12-09 Thread Grant Edwards
On 2008-12-09, greg [EMAIL PROTECTED] wrote: 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

Re: 'pretty print' for built in types

2008-12-09 Thread Chris Rebert
On Tue, Dec 9, 2008 at 7:31 AM, Robert Dailey [EMAIL PROTECTED] wrote: Hi, Is there a built in way to 'pretty print' a dict, list, and tuple (Amongst other types)? Dicts probably print the ugliest of them all, and it would be nice to see a way to print them in a readable way. I can come up

pickling a circular object inherited from list

2008-12-09 Thread Klaus Kopec
Hello everyone, 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: html codes

2008-12-09 Thread Daniel Fetchinson
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 stuff

Re: Google Summer of Code 2009

2008-12-09 Thread Eric
On Dec 9, 6:26 am, André [EMAIL PROTECTED] wrote: On Dec 8, 10:34 pm, Eric [EMAIL PROTECTED] wrote: You should have a look athttp://wiki.python.org/moin/SummerOfCode It's still early, so there's nothing yet for 2009, but I am sure that some ongoing projects mentioned in previous years [like

Re: StringIO in 2.6 and beyond

2008-12-09 Thread Bill McClain
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 error message. So this is an encoding problem? Can you give me a hint on

Re: as keyword woes

2008-12-09 Thread Aaron Brady
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 difficult way. as in

Re: How to initialize a class variable once

2008-12-09 Thread George Sakkis
On Dec 9, 10:36 am, 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. That's an excellent point -- this is something I've run into, and it  

When (and why) to use del?

2008-12-09 Thread Albert Hopkins
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_string # do some other stuff

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 error message.

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

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

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          

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(str('First

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 sentiment, you

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          

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

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        

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 notes,

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

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: 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 from

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: 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

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: 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

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 the Python parser

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

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: 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 comparisons to

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

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: 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(uhello, 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 terminators? I

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

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 performance

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(uhello, 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

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 a href=http://springpython.webfactional.com/reference/html/ objects.htmlIoC container/a involving constructor arguments, and I was able to reproduce the problem, patch it, and get it released quickly to the user

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 feasible.

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

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(uhello, 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

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: 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 stated before

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

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: snip def getAge():     while True:         try:             age = int(input('Please enter your age: '))          

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

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 best. I can

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 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:

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: 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): self.value =

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 that

  1   2   3   >