Re: [python-committers] Thank you Larry Hastings!

2020-10-06 Thread Nick Coghlan
Thank you, Larry! Cheers, Nick. -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Nick Coghlan
On 13 Dec 2014 05:19, "Petr Viktorin" wrote: > > Also keep in mind that not all Python libraries are on PyPI. > For non-Python projects with Python bindings (think video players, > OpenCV, systemd, Samba), distribution via PyPI doesn't make much > sense. And since the Python bindings are usually s

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Nick Coghlan
On 18 Nov 2013 22:36, "Robin Becker" wrote: > > On 18/11/2013 11:47, Robin Becker wrote: > ... >> >> #c:\python33\lib\site-packages\sitecustomize.py >> import sys, codecs >> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) >> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.det

Re: [python-committers] [RELEASED] Python 3.2 beta 2

2010-12-21 Thread Nick Coghlan
to improve Sequence ABC conformance and to make range objects more list-like) Cheers, Nick. -- Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASED] Python 3.1 final

2009-06-27 Thread Nick Coghlan
Benjamin Peterson wrote: > On behalf of the Python development team, I'm thrilled to announce the first > production release of Python 3.1. Excellent news! Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-22 Thread Nick Coghlan
ecoding and environment variable encoding/decoding? (the PEP currently only states that the encoding switch will be done for the file system encoding - it is silent regarding the other two system interfaces). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane

Re: [Python-Dev] "as" keyword woes

2008-12-06 Thread Nick Coghlan
oat_class) You could make a PEP if you really wanted to, but it's going to be rejected. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- -- http://mail.python.org/mailman/listinfo/python-list

Re: Redirecting warnings.showwarning to logging

2008-11-23 Thread Nick Coghlan
Tres Seaver wrote: > Nick Coghlan wrote: >> Antoine Pitrou wrote: >>> Brett Cannon python.org> writes: >>>> It is specifically there to be overridden (and as an aside, it was a >>>> pain to support in the C port of warnings), so it really isn't

Reducing import try/except boilerplate

2005-12-21 Thread Nick Coghlan
ogrammer wants Also: from threading or dummy_threading import Thread # No 'as' clause needed since the module name isn't bound Insomnia-induced-random-ideas-are-fun-'ly yours, Nick. -- Nick Coghlan

Re: Integer From A Float List?!?

2005-03-04 Thread Nick Coghlan
t(x))" 1000 loops, best of 3: 992 usec per loop For builtin functions, map is usually the fastest option (and, IMO, the most readable). List comprehensions should be preferred to map + lambda, though. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisba

Re: Call variable as a function

2005-03-04 Thread Nick Coghlan
;Hi there!" ... Py> var = "test" Py> locals()[var]() Hi there! Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: yield_all needed in Python

2005-03-03 Thread Nick Coghlan
Cheers, Nick. P.S. Which looks more like executable pseudocode? def traverse(node): yield *node.left yield node .value yield *node.right def traverse(node): yield x for x in node.left yield node .value yield x for x in node.rig

Re: yield_all needed in Python

2005-03-03 Thread Nick Coghlan
s clear as adding an asterisk to the front :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: yield_all needed in Python

2005-03-02 Thread Nick Coghlan
eyword gains a native genexp syntax). If anyone thinks that this would result in a couple of parentheses making too much difference, consider this: Py> [x for x in []] [] Py> [(x for x in [])] [] Cheers, Nick. -- Nick Coghlan

Re: Decimal, __radd__, and custom numeric types...

2005-03-02 Thread Nick Coghlan
Blake T. Garretson wrote: Thanks for the suggestions and modified module. I will probably just use this "fixed" module to solve my immediate problem. Expect its performance to be worse than the standard version - it does the right thing, but it sure ain't pretty. . . Cheers

Re: assigning a custom mapping type to __dict__

2005-03-02 Thread Nick Coghlan
dle this, but I can't". Maybe "__op__ = NotImplemented" should clear the associated slot. It would also make it easier to inherit from list and handle slices in __getitem__ by writing "__getslice__ = NotImplemented" instead of overriding __getslice__ to delegate t

Re: assigning a custom mapping type to __dict__

2005-03-02 Thread Nick Coghlan
they already are (as Duncan pointed out). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Initializing subclasses of tuple

2005-03-02 Thread Nick Coghlan
, please consider posting them on SF :) It's currently conspicuous by its absence: http://www.python.org/dev/doc/devel/ref/customization.html Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia ---

Re: reuse validation logic with descriptors

2005-03-02 Thread Nick Coghlan
nload/Descriptor.htm about 4 times along with your help to get this straight. If it only takes 2 or 3 re-reads to get descriptors, does that mean Python's black magic is really only a kind of off-white colour? Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane,

Re: What's the cost of using hundreds of threads?

2005-03-02 Thread Nick Coghlan
nificantly. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Batista, Facundo wrote: [Nick Coghlan] #- >> a) Checking that replacing the relevant "raise TypeError" #- calls in #- >> Lib/Decimal.py with "return NotImplemented" gives you friendlier #- >> behaviour. #- > #- > #- > It turns out this isn'

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Nick Coghlan wrote: Nick Coghlan wrote: a) Checking that replacing the relevant "raise TypeError" calls in Lib/Decimal.py with "return NotImplemented" gives you friendlier behaviour. It turns out this isn't really practical - there's too much code in the modu

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Nick Coghlan wrote: a) Checking that replacing the relevant "raise TypeError" calls in Lib/Decimal.py with "return NotImplemented" gives you friendlier behaviour. It turns out this isn't really practical - there's too much code in the module relying on those TypeErr

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
g the question up on py-dev as well. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning a custom mapping type to __dict__

2005-03-01 Thread Nick Coghlan
pping.html -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you control _all_ items added to a list?

2005-03-01 Thread Nick Coghlan
item__ and keys() With an appropriate ListMixin, providing the first three methods would suffice to support the full list API. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia ---

Re: string methods (warning, newbie)

2005-02-26 Thread Nick Coghlan
ension: Py> "".join([c for c in 'The Beatles - help - 03 - Ticket to ride' if c.isalpha( )]) 'TheBeatleshelpTickettoride' Py> Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: function expression with 2 arguments

2005-02-26 Thread Nick Coghlan
people to start out by at least skimming the freaking tutorial. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listi

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-26 Thread Nick Coghlan
? Actually, I was curious whether the 'zeros' method in [2] did the right thing. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-26 Thread Nick Coghlan
on.net/~hinsen/ScientificPython/ScientificPythonManual/Scientific_13.html -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Canonical way of dealing with null-separated lines?

2005-02-25 Thread Nick Coghlan
ly lost. Actually making it happen needs someone to step up and offer a patch to the relevant C code and documentation, though. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: rounding problem

2005-02-25 Thread Nick Coghlan
Dan Bishop wrote: Your statement is misleading, because it suggests that your processor stores digits. It doesn't; it stores *bits*. And where does the word 'bit' come from, hmm? It couldn't possibly be an abbreviation of Binary digIT, could it? Cheers, Nick. -- Nick

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Nick Coghlan
instead of the bytecode. If that happens, they might become less hackish. So I guess I should wait and see what the next few months holds in terms of AST-hacks :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane,

Re: Trees

2005-02-25 Thread Nick Coghlan
structures. All it would take to make it happen is a PEP, an implementation and a champion with some persuasive ability :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Nick Coghlan
Nick Coghlan wrote: Basically, yeah. Although I later realised I got the name of the feature I want wrong - default arguments are evaluated when the def statement is executed, not when the code is compiled. So it's a matter of being able to execute some code in the functions local namespa

Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Nick Coghlan
orth having, finding a decent syntax is the next trick :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Compile time evaluation (aka eliminating default argument hacks)

2005-02-24 Thread Nick Coghlan
code which doesn't depend on the functions arguments inside a 'use' block. For modules, data structures initialised inside a using block could simply be unmarshalled rather than built anew. Cheers, Nick. P.S. I didn't search the archive, because I couldn

Re: Dynamically pass a function arguments from a dict

2005-02-24 Thread Nick Coghlan
27; are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments. Don't-forget-the-std-lib'ly, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia ---

Re: Style guide for subclassing built-in types?

2005-02-24 Thread Nick Coghlan
diter(range(11) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Those benchmarks I mentioned earlier will let you know which approach is best. No-optimisations-without-measurements-'ly, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: Style guide for subclassing built-in types?

2005-02-23 Thread Nick Coghlan
[EMAIL PROTECTED] wrote: p.s. the reason I'm not sticking to reversed or even reverse : suppose the size of the list is huge. Reversed is an iterator - it does NOT copy the list. In other words, reversed already does pretty much what you want. Cheers, Nick. -- Nick Coghlan | [EMAIL PROT

Re: Problem with the sort() function

2005-02-22 Thread Nick Coghlan
if key is not None: seq = [elem for (key, i, elem) in seq] if reverse: seq.reverse() return seq list = mysort([[3,'fork',0.3,1],[2,'fork',0.1,2],[3,'exec',0.2,2]], key=lambda x: x[0]) (Taken from Raymond's code in: http://mail

Re: subclassing Decimal

2005-02-22 Thread Nick Coghlan
[EMAIL PROTECTED] wrote: yea-though-I-walk-thru-the-valley-of-__new__-I-will-fear-no-super-ly That's beautiful }:> Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia ---

Re: unicode encoding usablilty problem

2005-02-20 Thread Nick Coghlan
needs to discuss: What happens to __str__ and __unicode__? Is there a new __bytes__ slot? I wonder if Skip is still up for championing this one. . . Cheers, Nick. One PEP's enough for me (even though 338 doesn't seem to generate much interest) -- Nick Coghlan | [EM

Re: [ANN] Python 2.4 Quick Reference available

2005-02-20 Thread Nick Coghlan
the BDFL gave for preferring 'open' - it may be extended to opening other types of objects than files. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skyst

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Nick Coghlan
er than providing diff's and submitting appropriate patches to improve MinGW support in the main Python CVS. *shrug* Their call. Cheers, Nick. P.S. if Ilias volunteers, or offers to pay someone to do this, instead of just complaining, will hell freez

Re: unicode encoding usablilty problem

2005-02-20 Thread Nick Coghlan
e a bytes builtin which is a mutable byte sequence Alternately, add array.bytes as a subclass of array.array, that provides a nicer API for dealing specifically with byte strings. The main point being, the replacement for 'str' needs to be immutable or the upgrade

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-19 Thread Nick Coghlan
Paul Rubin wrote: Nick Coghlan <[EMAIL PROTECTED]> writes: Compare out-of-the-box Python: a = 1 + 2 + 3 + 4 And out-of-the-box Lisp: (setq a (+ 1 2 3 4)) Which language has the lower barrier for entry? That should be a fairly important consideration for a language that is going to sit

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-19 Thread Nick Coghlan
a (+ 1 2 3 4)) Which language has the lower barrier for entry? That should be a fairly important consideration for a language that is going to sit at the heart of an OS. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia -

Re: unicode encoding usablilty problem

2005-02-19 Thread Nick Coghlan
b"" to get a byte string instead of a character string. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: global var

2005-02-19 Thread Nick Coghlan
cation global it's wrong. Given the nature of the question, I suspect the latter. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: multimethod (or rather overloading) in Python

2005-02-19 Thread Nick Coghlan
/__init__.html I'm compelled to point out that PEAK should still be considered a 'work in progress', but PJE's ideas should help you out :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: Why doesn't join() call str() on its arguments?

2005-02-19 Thread Nick Coghlan
at's a long way away, though. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Nick Coghlan
ind the scenes has the potential to make the method behave *very* suprisingly depending on the objects involved. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Nick Coghlan
f the available options. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Nick Coghlan
ing the archives on python.org really easy. Of course, knowing what you're looking for because you were a participant in the discussion helps, too ;) -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- h

Re: [PATCH] allow partial replace in string.Template

2005-02-15 Thread Nick Coghlan
Stefan Behnel wrote: Nick Coghlan wrote a) Patches are more likely to be looked at if placed on the SF patch tracker. see your own b), I wanted to discuss them first. Fair enough. Still, when I first tried out the Template class, I immediately stumbled over the fact that the substitute methods

Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Nick Coghlan
a) Patches are more likely to be looked at if placed on the SF patch tracker. b) I don't quite see the point, given how easy these are to spell using the basic safe_substitute. You're replacing one liners with one-liners. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] |

Re: For American numbers

2005-02-14 Thread Nick Coghlan
where avoiding the ambiguity tends to matter more - in a conversation, if the difference actually matter, you can just ask. With a written document, requesting clarification often isn't so simple. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] |

Re: custom classes in sets

2005-02-14 Thread Nick Coghlan
nge the hash method to use the size of the file or something else that has to be equal for the comparison to be equal (like the hash of the first line, or of the entire file), and you should see much better behaviour. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTEC

Re: Kill GIL

2005-02-13 Thread Nick Coghlan
to a different platform without having to port the far more platform specific GUI. This would have been much harder if we weren't already using a CSP model for communication between different parts of the system) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane,

Re: builtin functions for and and or?

2005-02-13 Thread Nick Coghlan
it as often as I do). What do people think? I have never done this, would I just write up a PEP? I've posted a question to py-dev about it. If Raymond (the itertools maintainer) is supportive, then a PEP may not be needed. If not. . . yeah, a PEP would probably be required. Cheers, Nick. -- Ni

Re: For American numbers

2005-02-13 Thread Nick Coghlan
code - it's 'exbi' not 'ebi': http://en.wikipedia.org/wiki/Binary_prefix#IEC_standard_prefixes Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredoman

Re: [NooB] a Variable in multiple quotes...

2005-02-13 Thread Nick Coghlan
Michael Hoffman wrote: This is a fairly friendly group and they will answer even newbie questions amicably. Albeit with the occasional pointed comment about not at least skimming the tutorial when it covers the question asked ;) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED

Re: Kill GIL

2005-02-12 Thread Nick Coghlan
d in the last couple of paragraphs simple and easy to use, rather than on a misguided effort to "Kill the GIL". Cheers, Nick. P.S. If the GIL *really* bothers you, check out Stackless Python. As I understand it, it does its best to avoid the C stack (and hence thread

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-12 Thread Nick Coghlan
Nick Coghlan wrote: class Namespace(object): # etc def _update_dict(self, other): for k in other: setattr(self, k, other[k]) This doesn't work, as it doesn't allow the sequence of 2-tuples. So I copied the relevant check for a keys() attr

Re: For American numbers

2005-02-12 Thread Nick Coghlan
kes for better marketing copy. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: For American numbers

2005-02-12 Thread Nick Coghlan
nt(10**i) ... 10.000 bytes 10.000 bytes 10.000 kilobytes 9.766 kibibytes 10.000 megabytes 9.537 mebibytes 10.000 gigabytes 9.313 gibibytes 10.000 terabytes 9.095 tebibytes 10.000 petabytes 8.882 pebibytes 10.000 exabytes 8.674 ebibytes 10.000 zettabytes 8.470 zebibytes 10.000 yottabytes 8.272 yobibyte

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-12 Thread Nick Coghlan
27;y.z': 1} Py> vars(ns.y) {'x': <__main__.C object at 0x009EB8D0>} Py> vars(ns.y.x) {'z': 2} Combined with the update change, it means this code does the right thing: Py> settings = { ... "x" : 1, ... "y" : namespaces.Namespace(),

Re: Alternative to raw_input ?

2005-02-12 Thread Nick Coghlan
ually want an implementation that looks like: def cekaj(prompt="Press a key to continue"): while msvcrt.kbhit(): msvcrt.getch() if prompt is not None: print prompt msvcrt.getch() And the sample program would look like: cekaj("Hit a key!") print "

Re: deepcopy chokes with TypeError on dynamically assigned instance method

2005-02-12 Thread Nick Coghlan
more familiar with the guts of copy.py than I am might be able to give a better answer if they happen to see the question. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomand

Re: a sequence question

2005-02-12 Thread Nick Coghlan
David Isaac wrote: "Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] A bug report on Sourceforge would help in getting the problem fixed for the 2.5 docs Done. Bug 1121416, for anyone else interested. Looks Raymond agrees with me about the left-to-rig

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-12 Thread Nick Coghlan
designed to be inheritance friendly. Though I'd like it to have a shorter name. I'm lazy. 'from namespaces import Namespace as ns' :) I thought about suggesting simply 'space' as a name, but I think that's way too vague. We're using it as a namespace, so we migh

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-12 Thread Nick Coghlan
Nick Coghlan wrote: Py> class NS(namespaces.Namespace): ... x = prop ... Oops - c&p error here. This was actually: Py> class NS(namespaces.Namespace): ... x = prop ... __x__ = prop ... Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane,

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-12 Thread Nick Coghlan
descriptor machinery a bit further in order to design a lookup scheme that is most appropriate for namespaces, but the above example has convinced me that object.__getattribute__ is NOT it :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: a sequence question

2005-02-12 Thread Nick Coghlan
ting the docs to include that information would probably be a bigger issue, as it involves behaviour which is currently not defined by the library. Cheers, Nick. [1] http://www.python.org/dev/doc/devel/lib/built-in-funcs.html -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-12 Thread Nick Coghlan
other highlights are: NamespaceView supports Namespace instances in the constructor NamespaceChain inherits from NamespaceView (as per my last message about that) LockedView is a new class that supports 'locking' a namespace, so you can only modify existing names, and cannot add or remove

Re: Is this a bug? BOM decoded with UTF8

2005-02-11 Thread Nick Coghlan
UTF-8 data? WTF do you need a byte order marker for when you have 8-bit data?" It also clarifies Martin's comment about the UTF-8 codec ignoring the existence of this piece of silliness :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] |

Re: PyINI : Cross-Platform INI parser

2005-02-11 Thread Nick Coghlan
Peter Maas wrote: I think that a new config utility is worth the effort if it has the potential to put an end to roll-your-own config formats and parsers. http://www.python.org/moin/ConfigParserShootout Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia

Re: Statement coverage tools revisited

2005-02-11 Thread Nick Coghlan
_var_name" is "long_and_really_complicated_var_n ame" True Py> "long_and_really_complicated_non_var_name" is "long_and_really_complicated_n on_var_name" True Py> "long_and_really_complicated_non_var_name" * 20 is "long_and_really_complica ted_non_v

Re: Loading functions from a file during run-time

2005-02-11 Thread Nick Coghlan
;. The first is better when you do know the name of the module you want at coding time, but the latter is handy when you want to be dynamic about it. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia ---

Re: a sequence question

2005-02-11 Thread Nick Coghlan
David Isaac wrote: "Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Using zip(*[iter(l)]*N) or zip(*(iter(l),)*N) simply extends the above to the general case. Clearly true. But can you please go into much more detail for a newbie? I see that [iter(l)]

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-11 Thread Nick Coghlan
Lists (i.e. namespaces with a defined field order) Cheers, Nick -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-11 Thread Nick Coghlan
Hmm, I'm not so sure about this. I think that the right model is the way that a class instance is currently chained with its class. That is, assume we have the following: c = cls() ns = Namespace(vars(c), vars(cls)) # Using modified NS above nc = NamespaceChain(Namespace(vars(c)), Nam

Re: deepcopy chokes with TypeError on dynamically assigned instance method

2005-02-11 Thread Nick Coghlan
ce. If you actually copied them, they'd be bound to the *old* instance, rather than the new one. So I expect you'll need to provide a __deepcopy__ in order to correctly generate the instancemethods bound to the new instance. I also realised that the reason the use of a mutable default is OK here is

Re: convert list of tuples into several lists

2005-02-11 Thread Nick Coghlan
ent looking function call. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP

2005-02-11 Thread Nick Coghlan
that already, it just won't do what you want: r, g, b = col = dict(r = 4, g = 3, b = 12).values() The dict-based implementation means named tuples they ain't :) However, the namespaces module *would* provide a natural location for a NamedTuple class. Cheers, Nick. -- Nick Coghlan | [

Re: variable declaration

2005-02-10 Thread Nick Coghlan
obscured. x.=42 vsx:=42 seems a clear win for the second IMO. I'm forced to agree. So I'll use the latter syntax if I end up writing anything further about rebinding :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --

Re: Is Python as capable as Perl for sysadmin work?

2005-02-10 Thread Nick Coghlan
That module is. . . a) impressive b) very, very, wrong c) both a) and b) I think I'm voting for c). . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.sk

Re: lambda and for that matter goto not forgetting sugar

2005-02-10 Thread Nick Coghlan
ive way - it's more descriptive than anything. It's any language change that's designed to make common idioms easier to use. Cheers, Nick. No comment on the goto thing ;) -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: convert list of tuples into several lists

2005-02-10 Thread Nick Coghlan
is actually zip(*tuple(zip(*tuple(iterable. That's potentially an awful lot of data copying for an identity operation :) Anyway, I think it does make a decent case for an itertools.iunzip or some such beast. Cheers, Nick. -- Ni

Re: deepcopy chokes with TypeError on dynamically assigned instance method

2005-02-10 Thread Nick Coghlan
5ÛHH575-UAZWKVVP-7H2H48V3 wrote: class Foo(list): "Foo" def __init__(self, l=[]): Change this too: def __init__(self, l=None): if l is None: l = [] And see if your problem goes away. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane,

Re: That horrible regexp idiom

2005-02-10 Thread Nick Coghlan
'alternative patterns' case: if m using foo_pattern.search(subject) as m: pass elif m using bar_pattern.search(subject) as m: pass else: pass (Y'know, I'm pretty sure the impetus was regexp matching the *last*

Re: Testing conditions.

2005-02-10 Thread Nick Coghlan
an one nested if statement due to the 'problem' of not being to do an embedded assignment. *shrug* The issue has never really bothered me in practice. Heck, I often don't use nested assignment even in C, since the buggers can be so damn hard to read. That's mainly due to

Re: empty classes as c structs?

2005-02-10 Thread Nick Coghlan
Alex Martelli wrote: Nick Coghlan <[EMAIL PROTECTED]> wrote: For bindings, you could just go with standard Python semantics - normal name binding always happens in the innermost scope, so binding a name in a namespace should happen in the directly referenced namespace. Then you can shadow

Re: variable declaration

2005-02-10 Thread Nick Coghlan
er than globals, generic objects would work for using those, too. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list

Re: variable declaration

2005-02-09 Thread Nick Coghlan
Antoon Pardon wrote: Op 2005-02-08, Nick Coghlan schreef <[EMAIL PROTECTED]>: The CPython *_FAST opcodes relate to functions' local variables. Behind the scenes they are implemented as integer indexing operations into a pre-sized C array. Operations don't come much faster than

Re: empty classes as c structs?

2005-02-09 Thread Nick Coghlan
s the use of class definition syntax for simple data structures - lookup chaining, allowing fallback to an 'outer scope'. Even though we'll probably end up dropping the last couple as overengineering things for the first pass, they're still interesting ideas t

Re: empty classes as c structs?

2005-02-08 Thread Nick Coghlan
Michael Spencer wrote: Nick Coghlan wrote: The other issue is that a namespace *is* a mutable object, so the default behaviour should be to make a copy I don't follow this argument. Why does mutability demand copy? Given that somedict here is either a throwaway (in the classic

Re: variable declaration

2005-02-08 Thread Nick Coghlan
operation *theoretically* be quicker for the other cases which involve a real dictionary (or something that looks like one)? Well, perhaps. Although I can't see how the rebinding operation would gain a benefit that a standard binding operation wouldn't gain if placed at the exact same point. C

Re: variable declaration

2005-02-08 Thread Nick Coghlan
Just wrote: In article <[EMAIL PROTECTED]>, Nick Coghlan <[EMAIL PROTECTED]> wrote: Antoon Pardon wrote:ons already existing. The compilor might generate a RESTORE instruction. Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same work - check the name exists

  1   2   3   4   5   >