Re: [Python-Dev] PEP: __source__ proposal

2004-12-04 Thread Nick Coghlan
. The feature mentioned in the last paragraph is hard to show in the expected output :) -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] Re: long number multiplication

2004-12-07 Thread Nick Coghlan
. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list [EMAIL PROTECTED] http://mail.python.org/mailman

Re: [Python-Dev] Rewriting PEP4

2004-12-07 Thread Nick Coghlan
process) Security problems, no alternative: Due to security concerns, this module has been deprecated and will be removed in Python 2.6 (see PEP 4 for information on the deprecation process) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Re: long number multiplication

2004-12-07 Thread Nick Coghlan
Gah, sorry folks. I really ought to pay more attention to that send line. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] Re: 2.4 news reaches interesting places

2004-12-10 Thread Nick Coghlan
that calls those functions. Perhaps another section for External Libraries? If you're doing serious number crunching in Python, using NumPy is practically a requirement. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Re: Re: 2.4 news reaches interesting places

2004-12-15 Thread Nick Coghlan
with the DNS server, maybe they could add wiki.python.org while they're at it :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] Website documentation - link to descriptor information

2004-12-23 Thread Nick Coghlan
it be possible for the New-style classes link to be added to the sidebar menu for the individual version's documentation pages? Or else given its own link on the Topic Guides page? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] Subscribing to PEP updates

2005-01-06 Thread Nick Coghlan
notifications work correctly, the updates would even come with automatic diffs :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] Re: Subscribing to PEP updates

2005-01-07 Thread Nick Coghlan
Barry Warsaw wrote: Please do (he says, hoping it works :). Speaking of which. . . care to poke PEP 0 or one of the other PEP's? There's probably a couple of PEP's which could be moved from 'Open' to 'Accepted' or 'Accepted' to 'Implemented' to try it out. Cheers, Nick. -- Nick Coghlan

Re: [Python-Dev] an idea for improving struct.unpack api

2005-01-07 Thread Nick Coghlan
item in the returned tuple being the offset of the first byte after the end of the unpacked item. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] Son of PEP 246, redux

2005-01-13 Thread Nick Coghlan
): x.read() do any type checking at all? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing

Re: [Python-Dev] PEP 246, redux

2005-01-13 Thread Nick Coghlan
. . . -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org

Re: [Python-Dev] frame.f_locals is writable

2005-01-14 Thread Nick Coghlan
and 2.4. I realised after posting that the exec-based hack only works for poking values into the _current_ frame's locals, so my trick wouldn't have done what you needed, anyway. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-17 Thread Nick Coghlan
function doesn't have that association. Any code which makes use of im_class on unbound methods (even without involving pickling)is going to have trouble with the change. (Someone else will need to provide a real-life use case though, since I certainly don't have one). Regards, Nick. -- Nick

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-18 Thread Nick Coghlan
M.-A. Lemburg wrote: Nick Coghlan wrote: Guido van Rossum wrote: What do people think? (My main motivation for this, as stated before, is that it adds complexity without much benefit.) I'm in favour, since it removes the an unbound method is almost like a bare function, only not quite as useful

Re: [Python-Dev] __str__ vs. __unicode__

2005-01-19 Thread Nick Coghlan
to PyUnicode, PyObject_Unicode's handling of subclasses of builtins is decidedly odd: Py class C(str): ... def __str__(self): return I am a string! ... def __unicode__(self): return I am not unicode! ... Py c = C() Py str(c) 'I am a string!' Py unicode(c) u'' Cheers, Nick. -- Nick Coghlan

[Python-Dev] PEP 246 - concrete assistance to developers of new adapter classes

2005-01-21 Thread Nick Coghlan
experience) think such a class would be beneficial in encouraging good practices? Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] Allowing slicing of iterators

2005-01-24 Thread Nick Coghlan
example, here's how to skip the head of a zero-numbered list: for i, item in enumerate(ABCDEF)[1:]: print i, item Is this idea a non-starter, or should I spend my holiday on Wednesday finishing it off and writing the documentation and tests for it? Regards, Nick. -- Nick Coghlan | [EMAIL

Re: [Python-Dev] Allowing slicing of iterators

2005-01-25 Thread Nick Coghlan
) '89' Py len(revlst) 0 Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] Allowing slicing of iterators

2005-01-25 Thread Nick Coghlan
if they so choose. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] Speed up function calls

2005-01-25 Thread Nick Coghlan
are easily used both from Python and as direct entries in a C API. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] Allowing slicing of iterators

2005-01-25 Thread Nick Coghlan
, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] Allowing slicing of iterators

2005-01-26 Thread Nick Coghlan
. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman

Re: [Python-Dev] Re: Wanted: members for Python Security Response Team

2005-02-05 Thread Nick Coghlan
. Alternately, could some topics be set up on the existing lists? (ala the new PEP topic for the checkins list). Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

[Python-Dev] A hybrid C Python implementation for itertools

2005-02-13 Thread Nick Coghlan
] http://mail.python.org/pipermail/python-list/2005-February/266311.html [4] http://groups-beta.google.com/group/comp.lang.python/msg/a76b4c2caf6c435c -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-15 Thread Nick Coghlan
always the traditional response to want to fix it but can't due to backwards compatibility: a keyword argument that defaults to False. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] [ python-Bugs-1124637 ] test_subprocess is far too slow (fwd)

2005-02-17 Thread Nick Coghlan
, and running the long ones only if -uall or -usubprocess are given would seem reasonable. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] Proposal for a module to deal with hashing

2005-02-18 Thread Nick Coghlan
.__hash__ would seem to provide such a spelling, and allow object.__hash__ to be removed (fixing the above bug). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

[Python-Dev] Requesting that a class be a new-style class

2005-02-18 Thread Nick Coghlan
definitions - require inheriting from ClassicClass instead. This would also have the benefit that the elimination of defaulting to classic classes would cause a syntax error rather than subtle changes in behaviour. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] PEP 309 enhancements

2005-02-25 Thread Nick Coghlan
instance at 0x00A95710, 'e', 0) Notice that you *don't* want to use partialmethod when creating a static method. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] PEP 309 enhancements

2005-02-26 Thread Nick Coghlan
. 'partialmethod' fixes that - it allows creating a partial function which expects the next positional argument to be the first argument to the underlying function, while remaining positional arguments are appended as usual. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] PEP 309

2005-02-26 Thread Nick Coghlan
, for negative n it is the index of the last argument that is locked. An argument could be made for providing the names 'leftpartial' (fixing left-hand arguments) and 'rightpartial' (fixing right-hand arguments) as aliases for partial() and partial(-1) respectively. Regards, Nick. -- Nick Coghlan

Re: [Python-Dev] PEP 309

2005-02-26 Thread Nick Coghlan
Dima Dorfman wrote: Nick Coghlan [EMAIL PROTECTED] wrote: Here, b is specialized at cut time, a is passed through the slot, and c is passed through the implicit slots at the end. The only thing this can't do is a generic right-curry--where we don't know how many parameters come before the one we

Re: [Python-Dev] PEP 309 enhancements

2005-02-28 Thread Nick Coghlan
Samuele Pedroni wrote: Nick Coghlan wrote: The initial suggestion was to provide a __get__ method on partial objects, which forces the insertion of the reference to self at the beginning of the argument list instead of at the end: def __get__(self, obj, type=None): if obj is None

Re: [Python-Dev] Re: [Python Dev] PEP 309

2005-03-01 Thread Nick Coghlan
a few extra tools without impacting too badly on those people that *aren't* interested in FP related stuff. Cheers, Nick. Maybe we should open a book on the next method to make it into functional. Compose, perhaps? -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] Decimal returning NotImplemented (or not)

2005-03-01 Thread Nick Coghlan
Python 2.5's C implementation of Decimal follow the standard numeric coercion rules as described above? 2. Is it reasonable to class this as a bugfix and fix the Python version for 2.4.2? (2.4.1's a bit too soon for my liking) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane

Re: [Python-Dev] Decimal returning NotImplemented (or not)

2005-03-01 Thread Nick Coghlan
would continue to function. I didn't suggest this initially, since I didn't realise Decimal wasn't the only class with the problem, and I'm sure messing with PyNumber_* isn't possible for the 2.4 series :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Decimal returning NotImplemented (or not)

2005-03-02 Thread Nick Coghlan
. Particularly if we actually try to find a way to make it easier to 'do the right thing', rather than just changing Decimal. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Decimal returning NotImplemented (or not)

2005-03-02 Thread Nick Coghlan
. And could it be changed (Nick Coghlan's proposal seems good to me)? Take a look at my latest suggestion using OperatorTypeError and operatormethod. (which makes it easy to put the try/catch block in place if you want it, while still leaving it out for the common case). Cheers, Nick. -- Nick

Re: [Python-Dev] Decimal returning NotImplemented (or not)

2005-03-04 Thread Nick Coghlan
it interesting that string objects share the same characteristic of not respecting __rop__ when it is provided by another class that is not a subclass of string. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Decimal returning NotImplemented (or not)

2005-03-04 Thread Nick Coghlan
, the _convert_other gives a far more meaningful error message when things do go wrong. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] python-dev Summary for 2005-02-01 through 2005-02-14 [draft]

2005-03-04 Thread Nick Coghlan
. JJL's last comment applies to me, too, naturally :) Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] Documentation for __new__

2005-03-04 Thread Nick Coghlan
Steven Bethard has put together some text to add __new__ to the list of Basic Customisation methods in the language reference. Would one of the documentation folks care to take a look at it? The relevant SF tracker item is http://www.python.org/sf/1156412 Regards, Nick. -- Nick Coghlan

Re: [Python-Dev] Decimal returning NotImplemented (or not)

2005-03-07 Thread Nick Coghlan
the default context that the binary operators pick up. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] itemgetter/attrgetter extension

2005-03-10 Thread Nick Coghlan
attribute). For itemgetter, I'd like to see multiple arguments eventually map to multi-dimensional slices (to preserve symmetry with indexing syntax). Call it -1 for itemgetter and -0 for attrgetter. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] @deprecated (was: Useful thread project for 2.5?)

2005-03-10 Thread Nick Coghlan
using the method continues to be correct. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-10 Thread Nick Coghlan
: On the gripping hand :) -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] Adding any() and all()

2005-03-11 Thread Nick Coghlan
benefit me because I would no longer have to waste time figuring out what such code was doing - it would already be an explicit loop, or it would be using one of the standard reductive operations. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-11 Thread Nick Coghlan
a specific key function: x = collections.OrderedDict(sorted(d.itervalues(), key=keyfunc)) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-11 Thread Nick Coghlan
'from': (x from seq if f(x)) That rather breaks TOOWTDI though (since it is essentially new syntax for a for loop). And I have other hopes for the meaning of (x from ()). . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] Lambda deferred evaluation (was: Adding any() and all())

2005-03-11 Thread Nick Coghlan
favourite is (expr from args)): http://www.python.org/moin/AlternateLambdaSyntax Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] func.update_meta (was: @deprecated)

2005-03-11 Thread Nick Coghlan
Reinhold Birkenfeld wrote: Nick Coghlan wrote: A utility method on function objects could simplify this: newFunc.update_info(func) +1. This is really good for 90% of all decorator uses. But maybe a better name should be found, perhaps update_meta. I like update_meta Patch against current CVS

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-14 Thread Nick Coghlan
(first)() value += first # Add the elements for item in itr: value += item return value Py sum([]) 0 Py seq = ([1], [2], [3]) Py sum(seq) [1, 2, 3] Py seq ([1], [2], [3]) Py seq = ('1', '2', '3') Py sum(seq) '123' Py seq ('1', '2', '3') Cheers, Nick. -- Nick Coghlan | [EMAIL

Re: [Python-Dev] func.update_meta (was: @deprecated)

2005-03-14 Thread Nick Coghlan
of a metadata transfer method, though, since they're highly decorator dependent. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-14 Thread Nick Coghlan
Alex Martelli wrote: On Mar 14, 2005, at 11:20, Nick Coghlan wrote: ... Somewhat ugly, but backwards compatible: I realize you're mostly talking semantics, not implementation, but, as long as we're at it, could we pretty please have back the optimization indicated by...: It turns out

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-15 Thread Nick Coghlan
Guido van Rossum wrote: On Tue, 15 Mar 2005 00:05:32 +1000, Nick Coghlan [EMAIL PROTECTED] wrote: ... try: ... value += first ... except TypeError: ... raise TypeError(Cannot add first element %r to initial value %r % (first, value)) No, no, no! NO! Never catch a general exception

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-15 Thread Nick Coghlan
'. With the above compatibility change, getting all the way back to the existing sum() behaviour only requires changing point b. to say use zero as the initial value Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] (no subject)

2005-03-16 Thread Nick Coghlan
Phillip J. Eby wrote: At 10:36 PM 3/15/05 +1000, Nick Coghlan wrote: Does deciding whether or not to supply the function really need to be dependent on whether or not a format for __signature__ has been chosen? Um, no. Why would you think that? Pronoun confusion. I interpreted an 'it' in your

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-16 Thread Nick Coghlan
or not supplying a string of some description as the initial value can be legitimately translated to: if isinstance(initial, basestring): return initial + type(initial)().join(seq) rather than raising the current TypeError that suggests the programmer may want to rewrite their code. Cheers, Nick. -- Nick

Re: [Python-Dev] itertools.walk()

2005-03-16 Thread Nick Coghlan
= iter_factory(item) except TypeError: yield item else: if depth_first: itr = chain(walk(subitr), itr) else: itr = chain(itr, walk(subitr)) break else: break Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-17 Thread Nick Coghlan
all :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] itertools.walk()

2005-03-17 Thread Nick Coghlan
, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] python-dev Summary for 2005-03-01 through 2005-03-15 [draft]

2005-03-18 Thread Nick Coghlan
class additive_identity(object): ... def __add__(self, other): ... return other ... Py sum([a] * 5, additive_identity()) 'a' This is fairly abusive of sum, though :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] __metaclass__ problem

2005-03-18 Thread Nick Coghlan
Nick Coghlan wrote: If you are not getting an exception when breaking this rule, my guess would be that your metaclasses are not inheriting from 'type', or else are not invoking type's __new__ method. The logic to trigger the exception lives in type's __new__ method - if that doesn't get

Re: [Python-Dev] __metaclass__ problem

2005-03-18 Thread Nick Coghlan
Phillip J. Eby wrote: At 10:11 AM 3/19/05 +1000, Nick Coghlan wrote: 'Meta1' is NOT a subclass of 'Meta2', yet the exception is not thrown. Instead, the explicitly requested metaclass has been silently replaced with a subclass. I think the OP is justified in calling that 'suprising

[Python-Dev] identity operands (was python-dev Summary for 2005-03-01 through 2005-03-15 [draft])

2005-03-19 Thread Nick Coghlan
Kurt B. Kaiser wrote: Nick Coghlan [EMAIL PROTECTED] writes: This is fairly abusive of sum, though :) [snip Kurt's timings] Even avoiding the object instantiation doesn't help much: Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits

Re: [Python-Dev] Python 2.4 | 7.3 The for statement

2005-03-19 Thread Nick Coghlan
statement: for item in alist: if item is 1: break Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python

Re: [Python-Dev] Python 2.4 | 7.3 The for statement

2005-03-19 Thread Nick Coghlan
6 (to 22) 16 STORE_FAST 0 (item) 3 19 JUMP_ABSOLUTE 13 22 POP_BLOCK 23 LOAD_CONST 0 (None) 26 RETURN_VALUE Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] [AST] Procedure for AST Branch patches

2005-03-20 Thread Nick Coghlan
failures left in test_grammar are those relating to generator expressions. I've put a patch on SF (1166879) and assigned it to Jeremy with group AST. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] [AST] A somewhat less trivial patch than the last one. . .

2005-03-21 Thread Nick Coghlan
interested in better access to the SF trackers, rather than CVS access, though. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] @decoration of classes

2005-03-30 Thread Nick Coghlan
without allowing class decoration contains an important caveat: it requires that the decorators be written to support doing that. Allowing class decoration means any appropriate decorators can be used, unmodified, to affect classes as well as functions. Cheers, Nick. -- Nick Coghlan | [EMAIL

Re: [Python-Dev] @decoration of classes

2005-03-30 Thread Nick Coghlan
as a single unit. Anyway, I don't particularly feel the lack of class decorators, but I thought I should mention this (perhaps small) category of non-transforming decorators as a situation where class decoration would make more sense to me than using a metaclass. Cheers, Nick. -- Nick Coghlan

Re: [Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-06 Thread Nick Coghlan
AttributeError: yyy Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] threading (GilState) question

2005-04-07 Thread Nick Coghlan
/?func=detailaid=1044089group_id=5470atid=305470 [2] http://mail.python.org/pipermail/python-dev/2004-August/047870.html -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] Unified or context diffs?

2005-04-13 Thread Nick Coghlan
, Nick. [1] http://www.python.org/patches/ -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python

Re: [Python-Dev] Re: switch statement

2005-04-21 Thread Nick Coghlan
. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] anonymous blocks

2005-04-23 Thread Nick Coghlan
a SyntaxError, so it isn't ambiguous in any way) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev

Re: [Python-Dev] anonymous blocks

2005-04-23 Thread Nick Coghlan
(): begin_transaction() def __exit__(): ex = sys.exc_info() if ex[0] is not None: abort_transaction(): else: commit_transaction(): Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] PEP 310 and exceptions

2005-04-23 Thread Nick Coghlan
Nick Coghlan wrote: Alternately, PEP 310 could be defined as equivalent to: if hasattr(x, '__enter__'): x.__enter__() try: try: ... except: if hasattr(x, '__except__'): x.__except__(*sys.exc_info()) else

Re: [Python-Dev] PEP 310 and exceptions

2005-04-23 Thread Nick Coghlan
/else definition for 'with' blocks, I guess. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev

Re: [Python-Dev] PEP 310 and exceptions

2005-04-23 Thread Nick Coghlan
Aahz wrote: On Sat, Apr 23, 2005, Nick Coghlan wrote: In light of Alex's comments, I'd actually like to suggest the below as a potential new definition for PEP 310 (making __exit__ optional, and adding an __else__ handler): if hasattr(x, '__enter__'): x.__enter__() try: try

[Python-Dev] Re: __except__ use cases

2005-04-23 Thread Nick Coghlan
): self: return ._cache[key] Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] PEP 310 and exceptions

2005-04-24 Thread Nick Coghlan
Shane Hathaway wrote: Nick Coghlan wrote: Which means finding a different name for '__else__'. Two possibilities that occur to me are '__ok__' or '__no_except__'. The latter makes a fair amount of sense, since I can't think of a way to refer to the thing other than as a 'no exception' handler

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Nick Coghlan
: == except: pass The generator objects created by using yield would supply the new API, so would be usable immediately inside such 'with' blocks. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Nick Coghlan
, perhaps the exception used here should be the exception that is raised when a 'return' statement is encountered inside the block, rather than the more-likely-to-be-messed-with 'break' statement. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Nick Coghlan
Reinhold Birkenfeld wrote: Nick Coghlan wrote: Guido van Rossum wrote: [snip] - I think there's a better word than Flow, but I'll keep using it until we find something better. How about simply reusing Iteration (ala StopIteration)? Pass in 'ContinueIteration' for 'continue' Pass

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Nick Coghlan
() The non-looping version of with seems to give the best of both worlds - multipart operation can be handled by multiple with statements, and repeated use of the same suite can be handled by nesting the with block inside iteration over an appropriate generator. Cheers, Nick. -- Nick Coghlan

Re: [Python-Dev] Re: anonymous blocks

2005-04-27 Thread Nick Coghlan
Greg Ewing wrote: Nick Coghlan wrote: def template(): # pre_part_1 yield None # post_part_1 yield None # pre_part_2 yield None # post_part_2 yield None # pre_part_3 yield None # post_part_3 def user(): block = template() with block: # do_part_1 with block

Re: [Python-Dev] Re: anonymous blocks

2005-04-27 Thread Nick Coghlan
the inability to get out of the loop without exhausting the entire iterator. I need to think about some ideas involving iterator factories, then my objections may disappear. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Re: anonymous blocks

2005-04-27 Thread Nick Coghlan
raising it. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] Re: anonymous blocks

2005-04-28 Thread Nick Coghlan
I'd say 'could' rather than 'should', as it was an idle thought, rather than something I actually consider a good idea. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Re: anonymous blocks

2005-04-28 Thread Nick Coghlan
with that, and my reservations about PEP 340 are basically gone. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

Re: [Python-Dev] PEP 340 - possible new name for block-statement

2005-04-29 Thread Nick Coghlan
. Regardless of whether you like the above or not, I think the PEP's proposed use of 'as' is incorrect - it looks like the variable should be referring to the expression being iterated over, rather than the values returned from the iterator. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED

Re: [Python-Dev] PEP 340 - possible new name for block-statement

2005-04-29 Thread Nick Coghlan
in the except clause) -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] PEP 340 - possible new name for block-statement

2005-04-29 Thread Nick Coghlan
- if I break out of a standard for loop before exhausting the iterator, I would expect to be able to resume the iterator afterwards, rather than having it flushed behind my back. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] PEP 340 - possible new name for block-statement

2005-04-29 Thread Nick Coghlan
the generator should be finalised or not. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing

Re: [Python-Dev] Keyword for block statements

2005-05-01 Thread Nick Coghlan
, myLock) as f: for line in f: print line.rstrip() Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net

[Python-Dev] PEP 340: Else clause for block statements

2005-05-01 Thread Nick Coghlan
, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org

Re: [Python-Dev] PEP 340 -- loose ends

2005-05-03 Thread Nick Coghlan
and the new block statement, but I'm also a little concerned about incorrectly passing a block template to a for loop. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] PEP 340 -- loose ends

2005-05-03 Thread Nick Coghlan
to it if it means that for l in synchronized(lock) raises an immediate error instead of silently doing the wrong thing. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

  1   2   3   4   5   6   7   8   9   10   >