[Python-Dev] PEP 343 updated

2005-10-16 Thread Nick Coghlan
PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement - added __with__() method - added section on standard terminology (that is, contexts/context managers) - changed generator context decorator name to

[Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Nick Coghlan
On and off, I've been looking for an elegant way to handle properties using decorators. It hasn't really worked, because decorators are inherently single function, and properties span multiple functions. However, it occurred to me that Python already contains a construct for grouping multiple

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Antoine Pitrou
class Demo(object): @def_property class test: This is a test property def get(self): print Getting attribute on instance def set(self, value): print Setting attribute on instance def delete(self):

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Gary Poster
On Oct 16, 2005, at 9:56 AM, Nick Coghlan wrote: On and off, I've been looking for an elegant way to handle properties using decorators. This isn't my idea, and it might have been brought up here in the past to the same sorts of screams of horror to which you refer later, but I use the

Re: [Python-Dev] PEP 343 updated

2005-10-16 Thread Guido van Rossum
On 10/16/05, Nick Coghlan [EMAIL PROTECTED] wrote: PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement - added __with__() method - added section on standard terminology (that is, contexts/context

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Guido van Rossum
On 10/16/05, Nick Coghlan [EMAIL PROTECTED] wrote: On and off, I've been looking for an elegant way to handle properties using decorators. It hasn't really worked, because decorators are inherently single function, and properties span multiple functions. However, it occurred to me that

Re: [Python-Dev] PEP 343 updated

2005-10-16 Thread Andrew Koenig
PEP 343 has been updated on python.org. Highlights of the changes: - changed the name of the PEP to be simply The 'with' Statement Do you mean PEP 346, perchance? PEP 343 is something else entirely. ___ Python-Dev mailing list

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Calvin Spealman
On 10/16/05, Guido van Rossum [EMAIL PROTECTED] wrote: On 10/16/05, Nick Coghlan [EMAIL PROTECTED] wrote: On and off, I've been looking for an elegant way to handle properties using decorators. It hasn't really worked, because decorators are inherently single function, and properties

Re: [Python-Dev] Early PEP draft (For Python 3000?)

2005-10-16 Thread Calvin Spealman
On 10/14/05, Josiah Carlson [EMAIL PROTECTED] wrote: Calvin Spealman [EMAIL PROTECTED] wrote: On 10/11/05, Eyal Lotem [EMAIL PROTECTED] wrote: locals()['x'] = 1 # Quietly fails! Replaced by: frame.x = 1 # Raises error What about the possibility of making this

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Guido van Rossum
On 10/16/05, Calvin Spealman [EMAIL PROTECTED] wrote: On 10/16/05, Guido van Rossum [EMAIL PROTECTED] wrote: Nick, and everybody else trying to find a solution for this problem, please don't. There's nothing wrong with having the three accessor methods explicitly in the namespace, it's

Re: [Python-Dev] Unicode charmap decoders slow

2005-10-16 Thread Martin v. Löwis
Tony Nelson wrote: Umm, 0 (NUL) is a valid output character in most of the 8-bit character sets. It could be handled by having a separate exceptions string of the unicode code points that actually map to the exception char. Yes. But only U+ should normally map to 0. It could be

Re: [Python-Dev] Early PEP draft (For Python 3000?)

2005-10-16 Thread Josiah Carlson
Calvin Spealman [EMAIL PROTECTED] wrote: On 10/14/05, Josiah Carlson [EMAIL PROTECTED] wrote: Calvin Spealman [EMAIL PROTECTED] wrote: On 10/11/05, Eyal Lotem [EMAIL PROTECTED] wrote: locals()['x'] = 1 # Quietly fails! Replaced by: frame.x = 1 # Raises error

Re: [Python-Dev] Early PEP draft (For Python 3000?)

2005-10-16 Thread Calvin Spealman
On 10/16/05, Josiah Carlson [EMAIL PROTECTED] wrote: Calvin Spealman [EMAIL PROTECTED] wrote: On 10/14/05, Josiah Carlson [EMAIL PROTECTED] wrote: Calvin Spealman [EMAIL PROTECTED] wrote: On 10/11/05, Eyal Lotem [EMAIL PROTECTED] wrote: locals()['x'] = 1 # Quietly

Re: [Python-Dev] Divorcing str and unicode (no more implicit conversions).

2005-10-16 Thread Martin Blais
On 10/15/05, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Martin Blais wrote: On 10/3/05, Michael Hudson [EMAIL PROTECTED] wrote: Martin Blais [EMAIL PROTECTED] writes: How hard would that be to implement? import sys reload(sys) sys.setdefaultencoding('undefined') Hmmm any

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Greg Ewing
Guido van Rossum wrote: Nick, and everybody else trying to find a solution for this problem, please don't. Denying that there's a problem isn't going to make it go away. Many people, including me, have the feeling that the standard way of defining properties at the moment leaves something to

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Delaney, Timothy (Tim)
Greg Ewing wrote: class C: foo = overridable_property('foo', The foo property) def get_foo(self): ... def set_foo(self, x): ... This has the advantage that the accessor methods can be overridden in subclasses with the expected effect. This is a

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Guido van Rossum
[Guido] Nick, and everybody else trying to find a solution for this problem, please don't. [Greg Ewing] Denying that there's a problem isn't going to make it go away. Many people, including me, have the feeling that the standard way of defining properties at the moment leaves something to

[Python-Dev] Guido v. Python, Round 1

2005-10-16 Thread Neal Norwitz
We all know Guido likes Python. But the real question is do pythons like Guido? http://python.org/neal/ n ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Autoloading? (Making Queue.Queue easier to use)

2005-10-16 Thread Steven Bethard
Nick Coghlan wrote: Having module attribute access obey the descriptor protocol (__get__, __set__, __delete__) sounds like a pretty good option to me. It would even be pretty backwards compatible, as I'd be hardpressed to think why anyone would have a descriptor *instance* as a top-level

Re: [Python-Dev] Definining properties - a use case for classdecorators?

2005-10-16 Thread Delaney, Timothy (Tim)
Guido van Rossum wrote: To which Tim Delaney responded, have a look at my response here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/408713 I looked at that, and now I believe it's actually *better* to mention the property name twice, at least compared to Tim' s approach. I

Re: [Python-Dev] problem with genexp

2005-10-16 Thread Neal Norwitz
On 10/10/05, Neal Norwitz [EMAIL PROTECTED] wrote: There's a problem with genexp's that I think really needs to get fixed. See http://python.org/sf/1167751 the details are below. This code: foo(a = i for i in range(10)) I agree with the bug report that the code should either raise a