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

2005-01-28 Thread Greg Ewing
Guido van Rossum wrote: Here's a patch that gets rid of unbound methods, as discussed here before. A function's __get__ method now returns the function unchanged when called without an instance, instead of returning an unbound method object. I thought the main reason for existence of unbound

Re: [Python-Dev] Let's get rid of unbound methods

2005-01-28 Thread Greg Ewing
Tim Peters wrote: I expect that's because he stopped working on Zope code, so actually thinks it's odd again to see a gazillion methods like: class Registerer(my_base): def register(*args, **kws): my_base.register(*args, **kws) I second that! My PyGUI code is *full* of __init__ methods

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

2005-02-16 Thread Greg Ewing
otherwise. In Python the value itself knows whether it's signed or not. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Eliminating the block stack (was Re: Store x Load x -- DupStore)

2005-02-20 Thread Greg Ewing
. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] UserString

2005-02-20 Thread Greg Ewing
by strings. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Comment regarding PEP 328

2005-02-24 Thread Greg Ewing
Josiah Carlson wrote: if we could change import in such a way that made standard library imports different from standard library imports, we could ...go on to prove that black is white and get ourselves killed by a python on the next zebra crossing. -- Greg Ewing, Computer Science Dept

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

2005-03-12 Thread Greg Ewing
Nick Coghlan wrote: A suggestion was made on c.l.p a while back to have a specific module dedicated to reductive operations. That is, just as itertools is oriented towards manipulating iterables and creating iterators, this module would be oriented towards consuming iterators in a reductive

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-12 Thread Greg Ewing
Brian Sabbey wrote: I prefer re-using the 'for' loop for this purpose because it allows the problem to be solved in a general way by re-using a structure with which most users are already familiar, and uses generators, which are easier to use in this case than defining a class with __exit__,

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

2005-03-12 Thread Greg Ewing
Nick Coghlan wrote: That 'x in seq' bit still shouts containment to me rather than iteration, though. Perhaps repurposing '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 ()).

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Greg Ewing
, If there is a mechanism for passing a code block as a thunk to an arbitrary function, the function is free to loop or not as it sees fit. I'd just prefer the spelling of it didn't force you to make it look like it's looping when it's not. -- Greg Ewing, Computer Science Dept

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

2005-03-13 Thread Greg Ewing
think that if an identity is specified, it should be used even if the sequence is non-empty. The reason being that the user might be relying on that to get the semantics he wants. Think of the second argument as accumulator object rather than identity. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Greg Ewing
dt = stopwatch(): a() b() Whatever keyword is used is bound to not sound right for some usages, so it would be best if no keyword were needed at all. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-14 Thread Greg Ewing
by passing a thunk to a function that calls it repeatedly. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Exception needed: Not enough arguments to PyArg_ParseTuple

2005-03-14 Thread Greg Ewing
it has been passed, and most C implementations don't provide any way at all. That's why the calling interface to varargs functions invariably includes some way for the caller to indicate the number of arguments, such as a format string or a terminating NULL. -- Greg Ewing, Computer Science Dept

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

2005-03-14 Thread Greg Ewing
specified explicitly. In that case I would argue in favour of keeping it the way it is, since... currently sum([1,1], 40) equals 42. ...seems quite reasonable to me. Or at least as reasonable as anything else. -- Greg Ewing, Computer Science Dept, +--+ University

Re: [Python-Dev] comprehension abbreviation

2005-03-14 Thread Greg Ewing
, it just seems like a completely unnecessary layer of mental gymnastics... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA

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

2005-03-14 Thread Greg Ewing
Eric Nieuwland wrote: Perhaps the second argument should not be optional to emphasise this. After all, there's much more to sum() than numbers. I think practicality beats purity here. Using it on numbers is surely an extremely common case. -- Greg Ewing, Computer Science Dept

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

2005-03-16 Thread Greg Ewing
to .join(x). Although it might be better to call it str.concat() instead of str.sum(). -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary

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

2005-03-16 Thread Greg Ewing
the function is called. Not to mention that if the seq is empty, there's no way of knowing what T to instantiate... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Draft PEP to make file objects support non-blocking mode.

2005-03-20 Thread Greg Ewing
. This means recording that IOError(EAGAIN) is raised for an empty non-blocking read. Isn't that unix-specific? The file object is supposed to provide a more or less platform-independent interface, I thought. -- Greg Ewing, Computer Science Dept, +--+ University

Re: [Python-Dev] docstring before function declaration

2005-03-21 Thread Greg Ewing
significant. Currently I can leave some space before/after a docstring without breaking anything. This can help readability, especially for class docstrings. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Draft PEP to make file objects support non-blocking mode.

2005-03-21 Thread Greg Ewing
behave more like os.read/os.write, maybe called something like readsome() and writesome(). That would eliminate the need to extract and manipulate the fds, and might make it possible to do some of this stuff in a more platform-independent way. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Draft PEP to make file objects support non-blocking mode.

2005-03-21 Thread Greg Ewing
Donovan Baarda wrote: On Mon, 2005-03-21 at 17:32 +1200, Greg Ewing wrote: I don't agree with that. There's no need to use non-blocking I/O when using select(), and in fact things are less confusing if you don't. Because staller.py outputs and flushes a fragment of data smaller than selector.py

Re: [Python-Dev] Pickling buffer objects.

2005-04-18 Thread Greg Ewing
Travis Oliphant wrote: I'm proposing to pickle the buffer object so that it unpickles as a string. Wouldn't this mean you're only solving half the problem? Unpickling a Numeric array this way would still use an intermediate string. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
the point of view of the user of withfile, the name 'thefile' magically appears in the namespace without it being obvious where it comes from. (but assignments within the block should still affect its _surrounding_ namespace, it seems to me...). I agree with that much. -- Greg Ewing, Computer Science

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
that people want to do on a regular basis. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
rely on a function's signature alone to tell you much in any case. A distressingly large number of functions found in third-party extension modules have a help() string that just says something like fooble(arg,...) There's really no substitute for a good docstring! -- Greg Ewing, Computer Science

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
don't see a great need for blocks to be able to return values. How do blocks work with control flow statements like break, continue, yield, and return? Perhaps break and continue raise exceptions similar to StopIteration in this case? Something like that, yes. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] anonymous blocks

2005-04-22 Thread Greg Ewing
func Usage example: with_file(foo.txt, w) as f: f.write(My hovercraft is full of parrots.) Does that help? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] anonymous blocks

2005-04-22 Thread Greg Ewing
be added later, without disturbing anything. But I think it's best left out of an initial specification. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Greg Ewing
. IMO, that's the WISHBDITFP. :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Greg Ewing
-of-this-function. I'd feel uncomfortable if this were no longer true. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Greg Ewing
they're being used for a purpose very different from generating and iterating. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary

Re: [Python-Dev] Re: Re: anonymous blocks

2005-04-25 Thread Greg Ewing
it by means of a generator, you don't need a class at all -- just make the whole thing a generator function. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Re: switch statement

2005-04-25 Thread Greg Ewing
switched on all the time, and the operator being used for comparison. 2) The first case is syntactically different from subsequent ones, even though semantically all the cases are equivalent. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-26 Thread Greg Ewing
permit creating a new dialect. Or something. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-26 Thread Greg Ewing
in summary, I don't think you necessarily *need* macros to get nice-looking user-defined control structures. It depends on other features of the language. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Greg Ewing
Brett C. wrote: It executes the body, calling next() on the argument name on each time through until the iteration stops. But that's no good, because (1) it mentions next(), which should be an implementation detail, and (2) it talks about iteration, when most of the time the high-level intent has

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Greg Ewing
Guido van Rossum wrote: [Greg Ewing] * It seems to me that this same exception-handling mechanism would be just as useful in a regular for-loop, and that, once it becomes possible to put 'yield' in a try-statement, people are going to *expect* it to work in for-loops as well. (You can already put

Re: [Python-Dev] atexit missing an unregister method

2005-04-26 Thread Greg Ewing
atexit() hander to invoke it. I don't think there's any need to mess with the way atexit() currently works. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] defmacro

2005-04-26 Thread Greg Ewing
where they *do* feel so compelled, they might not if lambda weren't such a long word. I was just trying to understand why Smalltalkers seem to get on fine without macros, whereas Lispers feel they are needed. I think Smalltalk's lightweight block-passing syntax has a lot to do with it. -- Greg

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-26 Thread Greg Ewing
is loaded, its source code has long since been compiled into code objects. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Re: anonymous blocks vs scope-collapse

2005-04-26 Thread Greg Ewing
information about both scopes available. Although it might be better to have some sort of outer declaration for rebinding in the enclosing scope, instead of doing it on a whole-function basis. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] Re: Caching objects in memory

2005-04-26 Thread Greg Ewing
that it's important for them to know that mutable objects are never in danger of being shared, so you should at least tell them that much. Otherwise they may end up worrying unnecessarily that two of their lists might get shared somehow behind their back. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] site enhancements (request for review)

2005-04-26 Thread Greg Ewing
the source directory from the host system as a file share, and it turns out that reading a unix symlink from the Windows end just returns the contents of the link. Aaarrghh! Braindamage! -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] Re: anonymous blocks

2005-04-28 Thread Greg Ewing
Guido van Rossum wrote: And surely you exaggerate. How about this then: The with-statement is similar to the for-loop. Until you've learned about the differences in detail, the only time you should write a with-statement is when the documentation for the function you are calling

[Python-Dev] Anonymous blocks: Thunks or iterators?

2005-04-28 Thread Greg Ewing
Elegant as the idea behind PEP 340 is, I can't shake the feeling that it's an abuse of generators. It seems to go to a lot of trouble and complication so you can write a generator and pretend it's a function taking a block argument. I'd like to reconsider a thunk implementation. It would be a lot

Re: [Python-Dev] Anonymous blocks: Thunks or iterators?

2005-04-28 Thread Greg Ewing
variables. True, but is the difference all that great? It's just one more C-level indirection, isn't it? we'll want variables *assigned to* by the thunk also to be shared with the containing function, Agreed. We'd need to add a STORE_CELL bytecode or something for this. -- Greg Ewing, Computer

Re: [Python-Dev] Integrating PEP 310 with PEP 340

2005-04-28 Thread Greg Ewing
Nick Coghlan wrote: With an appropriate utility block manager I've just thought of another potential name for them: Block Utilization and Management Function (BUMF) :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

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

2005-04-28 Thread Greg Ewing
Neil Schemenauer wrote: A variation on this with somewhat different semantics swaps the keywords: in EXPR for VAR: BLOCK Looks weird to my eyes. Probably makes perfect sense if you're Dutch, though. :-) -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Re: anonymous blocks

2005-04-28 Thread Greg Ewing
the meanings of those particular uses, and leave the full general explanation as an advanced topic. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned

Re: [Python-Dev] Re: anonymous blocks

2005-04-28 Thread Greg Ewing
) as f: ... Then we could confuse both C *and* Ruby programmers at the same time! :-) [No, I don't really mean this. I actually prefer block to this.] -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

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

2005-05-01 Thread Greg Ewing
due to an exception, a break statement or a return statement) I've always thought that was a particularly unintuitive use of the word 'else', and I'm not sure I'd like it to be extended to any new statements. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] 2 words keyword for block

2005-05-03 Thread Greg Ewing
exercise typing redundant keywords, I'd program in COBOL. :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL

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

2005-05-04 Thread Greg Ewing
Frobbing: def __neg__(self): begin_frobbing() try: yield finally: end_frobbing() frobbing = Frobbing() ... -frobbing: do_something() -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] PEP 340: Only for try/finally?

2005-05-04 Thread Greg Ewing
there which take function arguments could *already* be used with a thunk-based block statement, without needing to be re-written at all. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch

Re: [Python-Dev] PEP 340: Breaking out.

2005-05-05 Thread Greg Ewing
propagates the Break exception back out, the block statement should break any enclosing loop. If the iterator wants to behave like a loop, it can catch the Break exception and raise StopIteration instead. -- Greg Ewing, Computer Science Dept, +--+ University

Re: [Python-Dev] PEP 340: propose to get rid of 'as' keyword

2005-05-05 Thread Greg Ewing
syntax and semantics. If new syntax and tricky new interactions with iterators are needed to support it, it doesn't seem so elegant any more. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] PEP 340 - Remaining issues - keyword

2005-05-05 Thread Greg Ewing
Nick Coghlan wrote: Something relatively nonsensical, but usefully mnemonic (like 'stmt') may be a good way to go. How about 'do'? do opening(filename) as f: ... do locking(obj): ... do carefully(): # :-) ... -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] PEP 340: Breaking out.

2005-05-05 Thread Greg Ewing
, having break depend on something defined somewhere completely else seems like an obstacle to easy understanding. IMHO, of course. //Simon -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] PEP 340: Breaking out.

2005-05-05 Thread Greg Ewing
existing PEP 340 semantics if uncaught, i.e. break an enclosing loop rather than just terminate the block statement. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Pre-PEP: Unifying try-except and try-finally

2005-05-05 Thread Greg Ewing
might find it useful for indenting a block of code for cosmetic reasons, although that could easily be seen as an abuse... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New

[Python-Dev] PEP 340 - For loop cleanup, and feature separation

2005-05-05 Thread Greg Ewing
by generators. This makes a lot more sense to me than trying to warp the iterator protocol to make it into a block protocol as well. Let's keep the two things orthogonal. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] PEP 340: Deterministic Finalisation (new PEP draft, either a competitor or update to PEP 340)

2005-05-09 Thread Greg Ewing
Ron Adam wrote: There seems to be some confusion as to weather or not 'for's will do finalizing. So I was trying to stress I think regular 'for' loops should not finalize. They should probably give an error if an object with an try-finally in them or an __exit__ method. But if the

Re: [Python-Dev] PEP 340: Deterministic Finalisation (new PEP draft, either a competitor or update to PEP 340)

2005-05-09 Thread Greg Ewing
. But I don't have a big crowd of people looking over my shoulder while I work, all trying to figure out why I chose one particular screwdriver over another, and decide which would be the best screwdriver to use on their screws. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] PEP 340: Deterministic Finalisation (new PEP draft, either a competitor or update to PEP 340)

2005-05-09 Thread Greg Ewing
, it could be as simple as testing whether a slot of a type object is populated during processing of the bytecode which causes exit from the loop. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-10 Thread Greg Ewing
Guido van Rossum wrote: Now it would make more sense to change the syntax to with EXPR as VAR: BLOCK and we have Phillip Eby's proposal. Change the 'with' to 'do' and I'd be +1 on this. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] PEP 340: Deterministic Finalisation (new PEP draft, either a competitor or update to PEP 340)

2005-05-10 Thread Greg Ewing
an __exit__ method if and only if they have a yield inside a try/finally? Old generators won't be doing that, because it's currently illegal. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] the current behavior of try: ... finally:

2005-05-12 Thread Greg Ewing
and continue) should be disallowed in a finally? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Tidier Exceptions

2005-05-12 Thread Greg Ewing
modules. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Tidier Exceptions

2005-05-12 Thread Greg Ewing
). Instead of an 'args' attribute, I'd suggest that the constructor take keyword arguments and store them in corresponding attributes. Then interested parties could retrieve them by name instead of having to remember their positions in the args tuple of the exception class concerned. -- Greg Ewing

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-12 Thread Greg Ewing
Guido van Rossum wrote: - Greg Ewing (I believe) wants 'do' instead of 'with' for the keyword. I think I like 'with' better, especially combining it with Benji's proposal. IMO this reads better with 'with' than with 'do': with open(/etc/passwd) as f: for line in f

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-12 Thread Greg Ewing
, that looks like nothing more than a local variable binding. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-13 Thread Greg Ewing
Here's my vote on things at the moment: +1 on do EXPR as VAR: ... +1 on keeping the EXPR and VAR distinct. +1 on keeping the do and generator protocols distinct. +1 on not going out of our way to let the controller catch exceptions or alter control flow. Let's keep it as simple as we

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-15 Thread Greg Ewing
Guido van Rossum wrote: Also, one question: will the do protocol be added to built-in resource types? That is, locks, files, sockets, and so on? One person proposed that and it was shot down by Greg Ewing. I think it's better to require a separate wrapper. It depends on whether the resource

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-15 Thread Greg Ewing
. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Greg Ewing
was that, with it, the semantics of a block statement would be almost, but not quite, exactly like those of a for-loop, which seems to be flying in the face of TOOWTDI. And if it weren't for the can't-finalise-generators-in-a-for-loop backward compatibility problem, the difference would be even smaller. -- Greg

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Greg Ewing
Ron Adam wrote: He should also be able to put try excepts before the yield, and after the yield, or in the block. (But not surrounding the yield, I think.) I was given to understand that yield is currently allowed in try-except, just not try-finally. So this would require a

Re: [Python-Dev] Simpler finalization semantics (was Re: PEP 343 - Abstract Block Redux)

2005-05-17 Thread Greg Ewing
Nick Coghlan wrote: the_stmt = EXPR1 stmt_enter = getattr(the_stmt, __enter__, None) stmt_exit = getattr(the_stmt, __exit__, None) if stmt_enter is None: VAR1 = the_stmt else: VAR1 = stmt_enter() If we're doing this, it might be better if VAR were simply

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-17 Thread Greg Ewing
Guido van Rossum wrote: Unfortunately I can't quite decide whether either rule applies in the case of exceptions. I think you'd at least be justified in using the magic rule, since they're set by the exception machinery. Greg ___ Python-Dev mailing

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-17 Thread Greg Ewing
Nick Coghlan wrote: Paul Moore wrote: On 5/17/05, Nick Coghlan [EMAIL PROTECTED] wrote: Previously Belaboured Point? (Just guessing from context here, but if I'm right, that's one acronym I'm going to have to remember. . .) Practicality Beats Purity, surely...? D'oh! *slaps forehead*

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325: generatorexceptions and cleanup

2005-05-18 Thread Greg Ewing
to put the same frame in the traceback twice, which can't work since it's a linked list. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325: generator exceptions and cleanup

2005-05-19 Thread Greg Ewing
that, all this looks good. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.11, 1.12

2005-05-19 Thread Greg Ewing
precision. It just seems to be asking for trouble. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Adventures with Decimal

2005-05-21 Thread Greg Ewing
Raymond Hettinger wrote: From the mists of Argentina, a Palidan set things right. The literal 1.1 became representable and throughout the land the monster was believed to have been slain. I don't understand. Isn't the monster going to pop right back up again as soon as anyone does any

Re: [Python-Dev] Adventures with Decimal

2005-05-22 Thread Greg Ewing
to what we are meaning by decimal value (i.e. an instance of Decimal). In other words, this principle only applies *after* we have constructed a Decimal instance. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] Adventures with Decimal

2005-05-23 Thread Greg Ewing
Raymond Hettinger wrote: Did you see Mike Cowlishaw's posting where he described why he took our current position (wysiwig input) in the spec, in Java's BigDecimal, and in Rexx's numeric model? Yes, it appears that you have channeled him correctly on that point, and Tim hasn't. :-) But I also

Re: [Python-Dev] PEP 343 - next steps

2005-06-12 Thread Greg Ewing
Guido van Rossum wrote: So (a) would have my preference. Mine, too. the PEP would have to be amended to state that VAR must be a single variable or a list of variables IN PARENTHESES. +1 -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread Greg Ewing
) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Terminology for PEP 343

2005-07-05 Thread Greg Ewing
Phillip J. Eby wrote: At 11:48 PM 7/3/2005 -0400, Raymond Hettinger wrote: with context_expression as variable: # perform actions within a context The with statement establishes a context in which some operations are to be performed. I like this. The object produced by

Re: [Python-Dev] List copy and clear (was Re: Inconsistent API for sets.Set and build-in set)

2005-07-05 Thread Greg Ewing
* for beginners. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] should doc string content == documentation content?

2005-07-24 Thread Greg Ewing
into memory until requested? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0

2005-07-31 Thread Greg Ewing
to lead to some awkward circumlocutions in the documentation and confusion in discussions. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned

Re: [Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0

2005-08-01 Thread Greg Ewing
. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] On decorators implementation

2005-08-22 Thread Greg Ewing
. But decorators in a class body are executed before the surrounding class even exists. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary

[Python-Dev] Alternative name for str.partition()

2005-08-29 Thread Greg Ewing
A more descriptive name than 'partition' would be 'split_at'. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Greg Ewing
JustFillBug wrote: trisplit() And then for when you need to record the result somewhere, tricord(). :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Greg Ewing
' seems rather too long-winded for such a useful little function. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Python 3 design principles

2005-08-31 Thread Greg Ewing
Charles Cazabon wrote: Perhaps py3k could have a py2compat module. Importing it could have the effect of (for instance) putting compile, id, and intern into the global namespace, making print an alias for writeln, There's no way importing a module could add something that works like the old

Re: [Python-Dev] Proof of the pudding: str.partition()

2005-08-31 Thread Greg Ewing
Josiah Carlson wrote: A bit of free thought brings me to the (half-baked) idea that if string methods accepted any object which conformed to the buffer interface; mmap, buffer, array, ... instances could gain all of the really convenient methods that make strings the objects to use in many

  1   2   3   4   5   6   7   8   9   10   >