[Python-Dev] Mixin classes in the standard library

2005-09-03 Thread Nick Coghlan
don't already have one... Where would we put it though? I sometimes wonder if there should be a 'mixins' module to provide a one-stop shop for finding things like DictMixin and ListMixin. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-03 Thread Nick Coghlan
to get around the tuple-related quirks of the string mod operator, and an enhancement to the string mod operator to deal better with iterables. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-03 Thread Nick Coghlan
Nick Coghlan wrote: I agree with this point actually. There should be an iterable formatting code that looks something like %[sep]i Then %i % (my_seq,) would be the equivalent of .join(my_seq), only allowing it to be easily embedded inside a larger format string. Some other examples

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-03 Thread Nick Coghlan
Nick Coghlan wrote: Nick Coghlan wrote: I agree with this point actually. There should be an iterable formatting code that looks something like %[sep]i Then %i % (my_seq,) would be the equivalent of .join(my_seq), only allowing it to be easily embedded inside a larger format string. Some

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-04 Thread Nick Coghlan
with is a weakness in the string formatting for iterables. The point about not needing parentheses for conditionals where a lot of other languages require them is a good one - I'm sure I write print statements nearly as often as I write conditionals. Cheers, Nick. -- Nick Coghlan | [EMAIL

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-04 Thread Nick Coghlan
Tony Meyer wrote: [Nick Coghlan] Print as statement = printing sequences nicely is a pain What's wrong with this? print range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] print tuple(string) ('s', 't', 'r', 'i', 'n', 'g') This is a serious question - that's how I would expect a print

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-06 Thread Nick Coghlan
__future__ import printing to disable the recognition of 'print' as a keyword in a particular module -- this would provide adequate future-proofing. Gah, sometimes I miss the most obvious of solutions. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-06 Thread Nick Coghlan
tool where you have to tell it which behaviour you want all the time (or pick one as the default, and have to remember to tell the application when you want the other behaviour). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0)

2005-09-06 Thread Nick Coghlan
wherever it sees $[fmt]name or $[fmt]{name} Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev

Re: [Python-Dev] Example for property violates Python is not a one pass compiler

2005-09-06 Thread Nick Coghlan
at compile time is the bytecode required to create the class or function - the definition isn't actually processed until runtime. It's easy to forget that difference (mainly because it doesn't matter very often). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Python 3 design principles

2005-09-07 Thread Nick Coghlan
library namespace, ... ? from __past__ import python2 If we ever get the ast-branch finished, then keeping a copy of the final 2.x parser around that targets the Python AST should actually be feasible, too. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-07 Thread Nick Coghlan
: - Py format(Kinda cute: $p0) 'Kinda cute: Kinda cute: $p0' - Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-07 Thread Nick Coghlan
Nick Coghlan wrote: I found the following to be an interesting experiment: - from string import Template def format(*args, **kwds): fmt = args[0] kwds.update((p%s % idx, arg) for idx, arg in enumerate(args)) return Template(fmt).substitute(**kwds) I

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-08 Thread Nick Coghlan
Barry Warsaw wrote: On Wed, 2005-09-07 at 08:55, Nick Coghlan wrote: The leading 'p' (for 'positional') is necessary to get around the fact that $1 is currently an illegal identifier in a Template That should be fixable. Ideally, $1 is better than $p1. I also looked into the idea

Re: [Python-Dev] Tools directory (Was RE: Replacement for print in Python 3.0)

2005-09-09 Thread Nick Coghlan
be an improvement on the status quo. I also noticed that the Windows installer does *not* install Tools/README.txt, so there isn't even a synopsis of the tools which _are_ included with the Windows installer. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] IDLE development

2005-09-10 Thread Nick Coghlan
will download and try out a patch to the main distribution. I'm such a one, even though I believe my main problems with Idle lie in the Tcl/tk toolkit (so I don't expect any application level changes to alter my opinion much). Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane

Re: [Python-Dev] python optimization

2005-09-16 Thread Nick Coghlan
statement is executed, rather than when the module is compiled, but that difference is not uncommon in Python (you don't know what half the names refer to until the top-level of the module is executed). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] Python 2.5a1, ast-branch and PEP 342 and 343

2005-09-16 Thread Nick Coghlan
included!) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] removing nested tuple function parameters

2005-09-18 Thread Nick Coghlan
have caused us any grief on the AST branch ;) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-20 Thread Nick Coghlan
in expression contexts, and +0 on the if/then/elif/else form (because I would like a real conditional operator). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-21 Thread Nick Coghlan
required around the whole thing, rather than around each element in the chain: (x if b else y if c else z) The point being that the result of the conditional expression is exactly one of the options included in the expression, so only one set of parentheses is required. Regards, Nick. -- Nick

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-21 Thread Nick Coghlan
a decision. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] Visibility scope for for/while/if statements

2005-09-23 Thread Nick Coghlan
the archives to see if the discussion has moved on since then, as I haven't been following c.l.p. for a good long while). Regards, Nick. [1] http://mail.python.org/pipermail/python-list/2005-January/259556.html -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-23 Thread Nick Coghlan
get my brain to accept it is by mentally replacing the if with ? and the else with :). Does it help if you think of if C else as a parameterised infix operation for choosing between the expressions on either side? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-27 Thread Nick Coghlan
and prefix conditional operators without colons (above) are the main options he is considering choosing from. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Active Objects in Python

2005-09-28 Thread Nick Coghlan
Greg Ewing wrote: Nick Coghlan wrote: PEP 342's yield expressions can probably be used to help address that problem, though: class SomeAO(ActiveObject): def processSomeMessage(self): msg = yield # Do something with the message next_msg = yield

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-29 Thread Nick Coghlan
argument to the binary operation in A. That said, the more verbose form still felt like it had the elements out of sequence - it was just crying out for the expression to be rewritten as a statement. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-29 Thread Nick Coghlan
. Even more annoying are constructs that don't gel with the rest of the language, though. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] PEP 350: Codetags

2005-09-30 Thread Nick Coghlan
-specific system of code tagging, rather than requiring that the project necessarily use the default style included in the processing module (Although using a system other than the default one may result in reduced functionality, naturally). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED

Re: [Python-Dev] Conditional Expression Resolution

2005-09-30 Thread Nick Coghlan
Guido van Rossum wrote: Congratulations gracefully accepted. Hurrah! Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] PEP 350: Codetags

2005-09-30 Thread Nick Coghlan
Guido van Rossum wrote: On 9/30/05, Nick Coghlan [EMAIL PROTECTED] wrote: An approach to this area that would make sense to me is: 1. Defer PEP 350 2. Publish a simple Python module for finding and processing code tags in a configurable fashion 3. Include a default configuration in the module

Re: [Python-Dev] Why does __getitem__ slot of builtin call sequence methods first?

2005-10-01 Thread Nick Coghlan
names don't match the methods normal Python syntax actually invokes, I find it hard to see how fixing it could cause any signficant problems. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Why does __getitem__ slot of builtin call sequence methods first?

2005-10-01 Thread Nick Coghlan
Nick Coghlan wrote: [A load of baloney] Scratch everything I said in my last message - init_slotdefs() sorts the slotdefs table correctly, so that the order it is written in the source is irrelevant. Travis found the real answer to his problem. Cheers, Nick. -- Nick Coghlan | [EMAIL

Re: [Python-Dev] PEP 343 and __with__

2005-10-04 Thread Nick Coghlan
patches for PEP 342 and PEP 343 against the trunk, but ast-branch still isn't even passing the Python 2.4 test suite, I'm wondering if it should be bumped from the feature list again. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] PEP 343 and __with__

2005-10-04 Thread Nick Coghlan
iterables and iterators is one well worth considering. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

[Python-Dev] Python 2.5 and ast-branch

2005-10-05 Thread Nick Coghlan
Guido van Rossum wrote: On 10/4/05, Nick Coghlan [EMAIL PROTECTED] wrote: I was planning on looking at your patch too, but I was waiting for an answer from Guido about the fate of the ast-branch for Python 2.5. Given that we have patches for PEP 342 and PEP 343 against the trunk, but ast-branch

[Python-Dev] Proposed changes to PEP 343

2005-10-07 Thread Nick Coghlan
to normal context -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev@python.org http

[Python-Dev] PEP 342 suggestion: start(), __call__() and unwind_call() methods

2005-10-07 Thread Nick Coghlan
need to remember to do is to write any potentially blocking operations as yielded lambda expressions or functional.partial invocations, rather than as direct function calls. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Proposed changes to PEP 343

2005-10-07 Thread Nick Coghlan
Fredrik Lundh wrote: Nick Coghlan wrote: 9. Here's a proposed native context manager for decimal.Context: # This would be a new decimal.Context method @contextmanager def __with__(self): wouldn't it be better if the ContextWrapper class (or some variation

Re: [Python-Dev] PEP 342 suggestion: start(), __call__() and unwind_call() methods

2005-10-07 Thread Nick Coghlan
Nick Coghlan wrote: It ends up looking like this: def __call__(self, value=None): Call a generator as a coroutine Returns the first argument supplied to StopIteration or None if no argument was supplied. Raises

Re: [Python-Dev] Proposed changes to PEP 343

2005-10-07 Thread Nick Coghlan
- the only difference is that the statement looks for a __with__ slot on the original EXPR, rather than looking directly for an __enter__ slot. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Proposed changes to PEP 343

2005-10-07 Thread Nick Coghlan
method for iterators. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list

Re: [Python-Dev] Proposed changes to PEP 343

2005-10-07 Thread Nick Coghlan
is worse, because it leaves open the nonsensical possibility of writing a __with__ method as a generator *without* applying the contextmanager decorator, and that would just be bizarre - if you want to get an iterable, why aren't you writing an __iter__ method instead? Cheers, Nick. -- Nick

[Python-Dev] Sourceforge CVS access

2005-10-07 Thread Nick Coghlan
Could one of the Sourceforge powers-that-be grant me check in access so I can update PEP 343 directly? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Pythonic concurrency

2005-10-07 Thread Nick Coghlan
saying threading is easy. If I encountered anyone who thought it was easy *in general*, then I would fear any threaded code they wrote, because they clearly weren't thinking about the problem hard enough ;) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Proposed changes to PEP 343

2005-10-07 Thread Nick Coghlan
Fredrik Lundh wrote: Nick Coghlan wrote: However, requiring a decorator to get a slot to work right looks pretty ugly to me, too. the whole concept might be perfectly fine on the this construct corre- sponds to this code level, but if you immediately end up with things that are not what

Re: [Python-Dev] Sandboxed Threads in Python

2005-10-07 Thread Nick Coghlan
to needing locking. And if you recreate everything in each sandbox, well, I think you've just reinvented processes. :) After all, there's a reason Bruce Eckel's recent post about multi-processing attracted a fair amount of interest. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED

Re: [Python-Dev] PEP 342 suggestion: start(), __call__() and unwind_call() methods

2005-10-07 Thread Nick Coghlan
Phillip J. Eby wrote: At 09:50 PM 10/7/2005 +1000, Nick Coghlan wrote: Notice how a non-coroutine callable can be yielded, and it will still work happily with the scheduler, because the desire to continue execution is indicated by the ContinueIteration exception, rather than by the type

Re: [Python-Dev] Sourceforge CVS access

2005-10-07 Thread Nick Coghlan
Guido van Rossum wrote: I will, if you tell me your sourceforge username. Sorry, forgot about that little detail ;) Anyway, its ncoghlan, same as the gmail account. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

[Python-Dev] test_cmd_line failure on Kubuntu 5.10 with GCC 4.0

2005-10-08 Thread Nick Coghlan
Anyone else seeing any problems with test_cmd_line? I've got a few failures in test_cmd_line on Kubuntu 5.10 with GCC 4.0 relating to a missing \n line ending. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] test_cmd_line failure on Kubuntu 5.10 with GCC 4.0

2005-10-08 Thread Nick Coghlan
Hye-Shik Chang wrote: On 10/8/05, Nick Coghlan [EMAIL PROTECTED] wrote: Anyone else seeing any problems with test_cmd_line? I've got a few failures in test_cmd_line on Kubuntu 5.10 with GCC 4.0 relating to a missing \n line ending. Same problem here. (FreeBSD 6.0 with GCC 3.4.4) In my

Re: [Python-Dev] Sandboxed Threads in Python

2005-10-08 Thread Nick Coghlan
, to something based subprocesses. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list

Re: [Python-Dev] PEP 342 suggestion: start(), __call__() and unwind_call() methods

2005-10-08 Thread Nick Coghlan
Guido van Rossum wrote: On 10/8/05, Nick Coghlan [EMAIL PROTECTED] wrote: So, instead of having return automatically map to raise StopIteration inside generators, I'd like to suggest we keep it illegal to use return inside a generator, and instead add a new attribute result to StopIteration

Re: [Python-Dev] PEP 342 suggestion: start(), __call__() and unwind_call() methods

2005-10-08 Thread Nick Coghlan
James Y Knight wrote: On Oct 8, 2005, at 9:10 PM, Nick Coghlan wrote: So, instead of having return automatically map to raise StopIteration inside generators, I'd like to suggest we keep it illegal to use return inside a generator Only one issue with that: it's _not currently

[Python-Dev] New PEP 342 suggestion: result() and allow return with arguments in generators (was Re: PEP 342 suggestion: start(), __call__() and unwind_call() methods)

2005-10-09 Thread Nick Coghlan
Nick Coghlan wrote: Although, if StopIteration.result was a read-only property with the above definition, wouldn't that give us the benefit of one obvious way to return a value from a coroutine without imposing any runtime cost on normal use of StopIteration to finish an iterator

Re: [Python-Dev] defaultproperty

2005-10-09 Thread Nick Coghlan
? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] New PEP 342 suggestion: result() and allow return with arguments in generators (was Re: PEP 342 suggestion: start(), __call__() and unwind_call() methods)

2005-10-10 Thread Nick Coghlan
Greg Ewing wrote: Nick Coghlan wrote: Sometimes I miss the obvious. There's a *much*, *much* better place to store the return value of a generator than on the StopIteration exception that it raises when it finishes. Just save the return value in the *generator*. I'm not convinced

Re: [Python-Dev] Fwd: defaultproperty

2005-10-11 Thread Nick Coghlan
Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev@python.org http

[Python-Dev] Making Queue.Queue easier to use

2005-10-11 Thread Nick Coghlan
to match the put_wait and get_wait methods above. If people are amenable to these ideas, I should be able to work up a patch for them this week. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Pythonic concurrency

2005-10-11 Thread Nick Coghlan
Donovan Baarda wrote: On Fri, 2005-10-07 at 23:54, Nick Coghlan wrote: [...] The few times I have encountered anyone saying anything resembling threading is easy, it was because the full sentence went something like threading is easy if you use message passing and copy-on-send or release

Re: [Python-Dev] problem with genexp

2005-10-11 Thread Nick Coghlan
be a SyntaxError - I believe the AST compiler actually raises one in this situation. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] C.E.R. Thoughts

2005-10-11 Thread Nick Coghlan
of the conditional expression :) We're-all-adults-here-ly yours, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python

Re: [Python-Dev] PEP 3000 and exec

2005-10-11 Thread Nick Coghlan
, but there are a few quirks with doing it that way). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] Pythonic concurrency

2005-10-11 Thread Nick Coghlan
, Python threading has its own traps for the unwary (mainly related to badly-behaved C extensions, but they're still traps). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] problem with genexp

2005-10-11 Thread Nick Coghlan
Nick Coghlan wrote: Neal Norwitz 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: I agree with the bug report that the code should either raise a SyntaxError or do the right thing. I agree

Re: [Python-Dev] Extending tuple unpacking

2005-10-11 Thread Nick Coghlan
of optional keyword arguments, rather than having to do: def f(a, b, *args, foo=1, bar=2): if args: raise TypeError(f() takes exactly 2 positional arguments (%d given), 2 + len(args)) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane

Re: [Python-Dev] Extending tuple unpacking

2005-10-11 Thread Nick Coghlan
Nick Coghlan wrote: For me, it stops when the rules for positional name binding are more consistent across operations that bind names (although complete consistency isn't possible, given that function calls don't unpack sequences automatically). Oops - forgot to delete this bit once I

Re: [Python-Dev] Pythonic concurrency

2005-10-11 Thread Nick Coghlan
, they had come to the conclusion that if they had a global variable, they could just stick a reference to it into a threading.local object and instantly have safe, concurrent access to it. Ouch. Copy, yes, reference, no. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED

Re: [Python-Dev] Extending tuple unpacking

2005-10-12 Thread Nick Coghlan
: http://mail.python.org/pipermail/python-dev/2004-November/050068.html Obviouly, I've changed my views over the last year or so ;) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Extending tuple unpacking

2005-10-13 Thread Nick Coghlan
, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] Extending tuple unpacking

2005-10-13 Thread Nick Coghlan
-lookahead, could we permit this syntax by rearanging bits of the grammer? I griped about this a while back, and got the impression from Guido that fixing it was possible, but it had simply never bugged anyone enough for them to actaully get around to fixing it. Cheers, Nick. -- Nick Coghlan

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

2005-10-13 Thread Nick Coghlan
, Nick. P.S. PeriodicTimer would be a variant of threading Timer which simply replaces the run method with: def run(): while 1: self.finished.wait(self.interval) if self.finished.isSet(): break self.function(*self.args, **self.kwds) -- Nick

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

2005-10-13 Thread Nick Coghlan
Queue.Queue. The latter jumps through a lot of hoops in order to be thread-safe. This confusion is one of the reasons I have a problem with the current name of the Queue module. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

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

2005-10-13 Thread Nick Coghlan
:( __main__.wrapper object at 0x00B9E3B0 But putting the exact same descriptor in a class lets it work its magic: Py class lazy(object): ... baz = baz ... Py lazy.baz Evaluating baz! 'Module attribute' Py baz 'Module attribute' Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane

Re: [Python-Dev] Sourceforge CVS access

2005-10-15 Thread Nick Coghlan
, and I still only have read access to the CVS repository. So if one of the SF admins could flip that last switch, that would be great :) Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Sourceforge CVS access

2005-10-15 Thread Nick Coghlan
Guido van Rossum wrote: With Neal's help I've fixed Nick's permissions. Enjoy, Nick! Thanks folks - it looks to be all good now. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

[Python-Dev] PEP 343 updated

2005-10-16 Thread Nick Coghlan
, such as the old contextmanager? (The PEP currently says context) - should the decorator be a builtin? (The PEP currently says yes) - should the decorator be applied automatically to generators used to write __with__ methods? (The PEP currently says yes) Cheers, Nick. -- Nick Coghlan | [EMAIL

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

2005-10-16 Thread Nick Coghlan
): print Setting attribute on instance def delete(self): print Deleting attribute on instance Comments? Screams of horror? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

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

2005-10-17 Thread Nick Coghlan
once again, that metaclasses are the one true way to monkey with classes ;) Cheers, Nick. P.S. I think I need an email program that disables the send button after 11 pm. . . -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] PEP 343 updated

2005-10-17 Thread Nick Coghlan
Guido van Rossum wrote: On 10/16/05, Nick Coghlan [EMAIL PROTECTED] wrote: I hope you reverted the status to Proposed... I hadn't, but I've now fixed that in CVS (both in the PEP and the PEP index), and added some text into the PEP saying why it was reverted to Draft. On the latter: I think

Re: [Python-Dev] PEP 343 updated

2005-10-17 Thread Nick Coghlan
for a with statement. The old name made perfect sense if you'd been part of the PEP 340 discussion, but was rather obscure otherwise. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

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

2005-10-17 Thread Nick Coghlan
Steven Bethard wrote: 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

Re: [Python-Dev] Coroutines, generators, function calling

2005-10-18 Thread Nick Coghlan
? ;) def show_message(msg): win = create_window(msg) for step in animate(win, xrange(10)): # slide down yield step yield Timeout(3) for step in animate(win, xrange(10, 0, -1)): # slide up yield step win.destroy() Cheers, Nick. -- Nick

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

2005-10-18 Thread Nick Coghlan
= 5: raise ValueError(value too big) instance._x = x def x.delete(instance): del instance._x Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

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

2005-10-19 Thread Nick Coghlan
, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] Pre-PEP: Task-local variables

2005-10-20 Thread Nick Coghlan
: raise RuntimeError(generator caught exception) def suspendable_context(func): def helper(*args, **kwds): return SuspendableGeneratorContext(func, args, kwds) return helper -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] Pre-PEP: Task-local variables

2005-10-21 Thread Nick Coghlan
the __suspend__/__resume__ idea up as another case of me getting overly enthusiastic about a complex idea without looking for simpler solutions first. It's not like it would be the first time ;) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] AST branch is in?

2005-10-21 Thread Nick Coghlan
with it on the AST branch, and am glad it has made its way onto the HEAD for Python 2.5. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] Pre-PEP: Task-local variables

2005-10-21 Thread Nick Coghlan
chance of YAGNI. We need experience with the 'with' statement before we can really identify the tools that are appropriate. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: [Python-Dev] Questionable AST wibbles

2005-10-21 Thread Nick Coghlan
is a generator or not, and including the entire compiler header just for that seemed like overkill. It's not a huge issue for me, but the separate header files do give better 'separation of concerns'. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: [Python-Dev] DRAFT: python-dev Summary for 2005-09-01 through 2005-09-16

2005-10-22 Thread Nick Coghlan
providing similar module level functions in the string module that correspond to the methods of Template objects?). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

[Python-Dev] Proposed resolutions for open PEP 343 issues

2005-10-22 Thread Nick Coghlan
actually do the right thing. Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list

Re: [Python-Dev] Proposed resolutions for open PEP 343 issues

2005-10-23 Thread Nick Coghlan
print Neither does this So how about if type_new simply raises a TypeError if it finds a generator-iterator function in the __context__ slot? Regards, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

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

2005-10-23 Thread Nick Coghlan
in kwds NAME = TYPE(NAME, ARGS, kwds) Such that the existing 'class' statement is equivalent to: create __metaclass__ NAME(ARGS): BLOCK Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

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

2005-10-24 Thread Nick Coghlan
): self._x = value def delete(self, value): del self._x (I put the metaclass after the keyword, because, unlike a function decorator, the metaclass is invoked *before* the class is created, and because you're only allowed one explicit metaclass) Cheers, Nick. -- Nick Coghlan

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-24 Thread Nick Coghlan
imdicts which compare equal (same contents) may not hash equal (different id's). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com

Re: [Python-Dev] Proposed resolutions for open PEP 343 issues

2005-10-24 Thread Nick Coghlan
useful, though. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.blogspot.com ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] PEP 351, the freeze protocol

2005-10-25 Thread Nick Coghlan
Josiah Carlson wrote: Nick Coghlan [EMAIL PROTECTED] wrote: I think having dicts and sets automatically invoke freeze would be a mistake, because at least one of the following two cases would behave unexpectedly: I'm pretty sure that the PEP was only aslomg if one would freeze

Re: [Python-Dev] Proposed resolutions for open PEP 343 issues

2005-10-25 Thread Nick Coghlan
Almost there - this is the only issue I have left on my list :) Guido van Rossum wrote: On 10/24/05, Nick Coghlan [EMAIL PROTECTED] wrote: However, those resolutions bring up the following issues: 5 a. What exception is raised when EXPR does not have a __context__ method? b. What

Re: [Python-Dev] Proposed resolutions for open PEP 343 issues

2005-10-25 Thread Nick Coghlan
Guido van Rossum wrote: On 10/25/05, Nick Coghlan [EMAIL PROTECTED] wrote: Almost there - this is the only issue I have left on my list :) [,,,] Why are you so keen on TypeError? I find AttributeError totally appropriate. I don't see symmetry with for-loops as a valuable property here

<    1   2   3   4   5   6   7   8   9   10   >