Re: [Python-Dev] str.count is slow

2006-02-28 Thread Greg Ewing
when I *do* put all my declarations before my non-declarations, I can live with that. :-) -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/pyt

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-02-28 Thread Greg Ewing
program-accessible entities. So we'd end up implementing our own form of dynamic dispatch anyway, and it would probably look a lot like the current C-based type objects. I don't see that C++ would help much. -- Greg ___ Python-Dev m

Re: [Python-Dev] defaultdict and on_missing()

2006-02-28 Thread Greg Ewing
dated to look for __send__ or something like that, and existing iterators need not have been affected. So the reason I'd like to see this changed in 3.0 is not because of consistency for its own sake, but because it would provide a better basis for future development. -- Greg _

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
them to just bytes and characters? Following that through leads to giving *every* object .encode() and .decode() methods. I don't think we should go that far, but it's hard to see where to draw the line. Are bytes and strings special enough to justify them having their own peculiar methods

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
Bill Janssen wrote: > No, once it's in a particular encoding it's bytes, no longer text. The point at issue is whether the characters produced by base64 are in a particular encoding. According to my reading of the RFC, they're not. -- Greg Ewing, Com

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
it > might make things clearer over decode and encode. Another thing is that it only works if the codec transforms between two different types. If you have a bytes-to-bytes transformation, for example, then b2 = b1.tobytes('some-weird-encoding

Re: [Python-Dev] iterator API in Py3.

2006-03-01 Thread Greg Ewing
Raymond Hettinger wrote: > [Greg Ewing] > > > And you don't think there are many different > > types of iterables? > > Um, I meant iterators and suspect you meant the same -- The same comment applies either way. Each type of iterable usually has its own correspondi

Re: [Python-Dev] bytes thoughts

2006-03-01 Thread Greg Ewing
Baptiste Carvello wrote: > while manipulating binary data will happen mostly with bytes objects, some > operations are better done with ints, like the bit manipulations with the > &|~^ > operators. Why not just support bitwise operations directly on the bytes object? -- Greg

Re: [Python-Dev] defaultdict and on_missing()

2006-03-01 Thread Greg Ewing
seq, sep): if hasattr(sep, '__join__'): return sep.__join__(seq) else: # generic implementation Then you could get nice fast type-specific implementations for strings, bytes, etc., without being limited to those types. -- Greg Ewing, Computer Science Dept, +-

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
your strings contain piglatin and which don't. Is this scheme any better than having encode and decode methods/functions? I'm not sure, but it shows that a suitably enhanced notion of "data type" can be used to replace the notions of encoding and decoding and maybe reduce poten

Re: [Python-Dev] bytes.from_hex()

2006-03-02 Thread Greg Ewing
ing to continue to use 'encode' and 'decode', why not just make them functions: b = encode(u, 'utf-8') u = decode(b, 'utf-8') In the case of Unicode encodings, if you get them backwards you'll get a type error. The advantage of u

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-02 Thread Greg Ewing
rse. A rather heavyweight solution to a problem that does not seem to have been a problem in practice so far, only in theory. Practicality beats purity once again... -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mail

Re: [Python-Dev] bytes.from_hex()

2006-03-02 Thread Greg Ewing
you *can* load an XML file into what we call a "text editor" say something?) > nobody but authors of > wire drivers[2] and introspective code will need to _explicitly_ call > .encode('base64'). Even a wire driver writer will only need it if he's trying to turn

Re: [Python-Dev] bytes.from_hex()

2006-03-03 Thread Greg Ewing
etc -- because mail and news at the time were strictly text channels. They still are, really -- otherwise we wouldn't be using anything as hairy as MIME, we'd just mail our binary files as-is. -- Greg ___ Python-Dev mailing list Python-Dev@python

Re: [Python-Dev] bytes.from_hex()

2006-03-03 Thread Greg Ewing
fixed type that you then transform to what you want. I suspect that said transformation would involve some further encoding or decoding, in which case you really have more than one codec. -- Greg ___ Python-Dev mailing list Python-Dev@python.org htt

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Greg Ewing
enough to find out how much of a disaster this would have been to use, though. :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a mor

Re: [Python-Dev] conditional expressions - add parens?

2006-03-07 Thread Greg Ewing
7;s enough that you *can* put parentheses around things if it helps readability. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning pe

Re: [Python-Dev] "as" mania

2006-03-07 Thread Greg Ewing
at would be while (next_x() as x) < threshold: ... i.e. 'x as y' would be an expression. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christ

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Greg Ewing
Oleg Broytmann wrote: >IDEs. Edit a code in an editor, run python -i script.py, investigate the > environment, return to the editor, get error message. An IDE is likely to want to catch SystemExits in the debugged script and handle them specially anyway. -- Greg Ewing, Computer S

Re: [Python-Dev] Making builtins more efficient

2006-03-09 Thread Greg Ewing
ditional gains can be > made be focusing just on builtins. As long as builtins can be shadowed, I can't see how to make any extra use of the fact that it's a builtin. A semantic change would be needed, such as forbidding shadowing of builtins,

Re: [Python-Dev] Making builtins more efficient

2006-03-09 Thread Greg Ewing
Raymond Hettinger wrote: > That is going to be difficult as long as it is legal to write: > > True = 0 BTW, are there any plans to make True and False hard constants in 3.0 (like None is now)? Maybe also others like Ellipsis, NotImplemented, e

Re: [Python-Dev] Making builtins more efficient

2006-03-10 Thread Greg Ewing
Guido van Rossum wrote: > I don't think we should make any of these keywords. Not even True and False? The only good reasons I can see for anyone wanting to shadow these are backwards compatibility ones. Greg ___ Python-Dev mailing list Py

Re: [Python-Dev] Making builtins more efficient

2006-03-12 Thread Greg Ewing
ing a couple of dictionary lookups. However, if a more general way is found of optimising global lookups, this may become a non-issue. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http

Re: [Python-Dev] Making builtins more efficient

2006-03-12 Thread Greg Ewing
ls it uses. Builtins can have dedicated opcodes which perform a fast check for shadowing in the module and builtin arrays. Everything goes as fast as possible while still allowing anything to be overridden. Greg ___ Python-Dev mailing list Python-Dev@pyt

Re: [Python-Dev] conditional expressions - add parens?

2006-03-12 Thread Greg Ewing
ferent * functions with different numbers of parameters. BTW, I did use Lisp and Scheme fairly heavily for a period, and didn't find them to be disasters -- at least not because of the parens. Greg ___ Python-Dev mailing list Python-Dev@pyth

Re: [Python-Dev] About "Coverity Study Ranks LAMP Code Quality"

2006-03-13 Thread Greg Ewing
es" ;-) Could whoever did this perhaps post a brief description of what sort of information their tool produces, and how good a hit rate they have of finding real problems? Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.

Re: [Python-Dev] About "Coverity Study Ranks LAMP Code Quality"

2006-03-14 Thread Greg Ewing
returned, how are you supposed to know which one is the junk? Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] Py3k: Except clause syntax

2006-03-15 Thread Greg Ewing
For Py3k, any thoughts on changing the syntax of the except clause from except , : to except as : so that things like except TypeError, ValueError: will do what is expected? Greg ___ Python-Dev mailing list Python-Dev@python.org http

[Python-Dev] open() mode is lax

2006-03-15 Thread Greg Ewing
; or "license" for more information. >>> f = open("DU", "rqwerty") >>> -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchu

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Greg Ewing
interests of refusing the temptation to guess, I'd go for the ValueError. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Greg Ewing
. Could we perhaps call it a bytevector or bytearray or something? Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Python Library Reference top page too long

2006-03-16 Thread Greg Ewing
egory. For example: > Sequence Types (str, unicode, list, tuple, buffer, xrange) > Mapping Types (dict) +1 Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-16 Thread Greg Ewing
Baptiste Carvello wrote: > what about > > except with : > > a program dies "with" an error message, not "as" an error message. No. The exception object you're catching *is* the value, not something which *has* a value. I maintain that &qu

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-17 Thread Greg Ewing
Georg Brandl wrote: > I predict people will come and write > > except NameError as e, OtherError as f: Then they'll learn very fast not to write that, because they'll get a SyntaxError. Greg ___ Python-Dev mailing list Python-

Re: [Python-Dev] Expose the array interface in Python 2.5?

2006-03-17 Thread Greg Ewing
ray interface is only for temporary use. I also don't see what relevance the semantics of Python indexing or mutation has. The array interface should just report the location and shape of the data as it happens to be when the call is made. What happens to it in between times is entirely up

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-18 Thread Greg Ewing
Barry Warsaw wrote: > On Sat, 2006-03-18 at 19:32 +0100, Giovanni Bajo wrote: >>Unless this new proposal also includes changing the meaning of "except:" to >>"except Error". Then maybe it should be called "

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-18 Thread Greg Ewing
ing warnings whenever you inherit directly from Exception. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-18 Thread Greg Ewing
cially compared to some of the other exception hierarchy reorganisations that have been proposed. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-18 Thread Greg Ewing
bound name is of secondary importance and only relevant to the code in the except clause. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-18 Thread Greg Ewing
the disadvantage that except E1 or E2 as e: would *not* be equivalent to except (E1 or E2) as e: On the other hand, in except E1, E2 as e: the E1, E2 is just a tuple expression, so it's exactly equivalent to except (E1, E2) as e: Greg __

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-18 Thread Greg Ewing
gt; # something If except clauses are changed to use "as", then as long as we're still allowing bare excepts, that could become except as e: ... Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/m

Re: [Python-Dev] Expose the array interface in Python 2.5?

2006-03-18 Thread Greg Ewing
stand the proposals, the important thing for interoperability between different types is to have (1). Whereas (2) would be useful to have, it's not a prerequisite for (1). Do I understand correctly? Greg ___ Python-Dev mailing list Python-Dev@pytho

Re: [Python-Dev] Expose the array interface in Python 2.5?

2006-03-19 Thread Greg Ewing
earrange their internal structure to use this new C-object. So I still think the standardised interface is more important and should have a higher priority than the new object. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/ma

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-19 Thread Greg Ewing
Just van Rossum wrote: > Greg Ewing wrote: > > > Also maybe start issuing warnings whenever you inherit > > directly from Exception. > > Ugh. I hate it when it's made (virtually) impossible to write code that > runs warnings-free on both Python X.Y and X.(Y+1

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-19 Thread Greg Ewing
For the purpose of minimising bare-except problems, recommending direct derivation from Exception seems like a particularly bad idea, whether the exception hierarchy is changed or not. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.p

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-20 Thread Greg Ewing
Guido added them because he thought it looked better that way. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.)

Re: [Python-Dev] Python 3000 Process

2006-03-20 Thread Greg Ewing
Guido van Rossum wrote: > respond with a +1 > or -1 on the creation of the python-3000 mailing list. +1 -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Z

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-20 Thread Greg Ewing
tion details of the function that aren't relevant to the caller. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-20 Thread Greg Ewing
n" will not catch all exceptions. My thoughts exactly. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-20 Thread Greg Ewing
around making sure everyone's errors are standardised? :=) Also, "standard error" sounds like some sort of statistical term to me... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam!

Re: [Python-Dev] GeneratorExit inheriting from Exception

2006-03-20 Thread Greg Ewing
things that you will almost always not want to catch, even in a top-level catch-almost-everything loop. So I'd leave these two out on their own. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam!

Re: [Python-Dev] Py3k: Except clause syntax

2006-03-22 Thread Greg Ewing
Tristan Seligmann wrote: > Greg Ewing <[EMAIL PROTECTED]> [2006-03-21 13:20:53 +1200]: > > Gareth McCaughan wrote: > > > > > >def f((x0,y0) as p0, (x1,y1) as p1): > For maximal utility, this would affect the calling signature of the > function, too: it

[Python-Dev] Pickling problems are hard to debug

2006-03-25 Thread Greg Ewing
to pickle or where abouts it turns up in the data structure. Anyone have any ideas how the situation could be improved? At the very least, it could include some info about the type and identity of the offending object. Greg ___ Python-Dev mailing list P

[Python-Dev] Class decorators

2006-03-26 Thread Greg Ewing
ot what I'd want. The general principle brought out here is that when you use a metaclass, it gets inherited by subclasses, but if we had class decorators, they would only affect to the classes that you explicitly applied them to. I think there are uses for both behaviours. Greg ___

Re: [Python-Dev] PySet API

2006-03-27 Thread Greg Ewing
but which uses the general iterator protocol underneath. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Expose the array interface in Python 2.5?

2006-03-27 Thread Greg Ewing
ensional arrays really are very useful for > all sorts of stuff that have nothing to do with high-performance Numeric > computing. I'm all in favour of including such an object, as long as we keep in mind that this is an orthogonal issue to having an array interface. The discussion sti

Re: [Python-Dev] INPLACE_ADD and INPLACE_MULTIPLY oddities in ceval.c

2006-03-27 Thread Greg Ewing
to force an arithmetic interpretation for "+" when adding a sequence to an array. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/pyth

Re: [Python-Dev] PySet API

2006-03-27 Thread Greg Ewing
ss to it is probably wrong. Clearability is not a general feature in Python land -- a few types have a clear() method, but this is an ad hoc feature of the type concerned. I don't think it makes sense to have a general PyObject_Clear function at all. -- Greg __

Re: [Python-Dev] Class decorators

2006-03-27 Thread Greg Ewing
l like actually using it, though. Class decorators would be so much more straightforward and explicit. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailm

Re: [Python-Dev] INPLACE_ADD and INPLACE_MULTIPLY oddities in ceval.c

2006-03-28 Thread Greg Ewing
b. This would be very different from the current behaviour of Numeric arrays. I don't know whether Numeric users would consider it a serious problem or not, but I think we need to consider the implications before charging ahead too fast with slot unification. -- Greg

Re: [Python-Dev] PySet API

2006-03-28 Thread Greg Ewing
I an albatross." And perhaps in Py3k the same could be done for dicts, and any other builtin types with concrete access functions? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubsc

Re: [Python-Dev] INPLACE_ADD and INPLACE_MULTIPLY oddities in ceval.c

2006-03-28 Thread Greg Ewing
t and what it does give is based on the assumption that concatenation is what the user has in mind. He might just as easily have been thinking of addition, or something else entirely. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mai

Re: [Python-Dev] PySet API

2006-03-28 Thread Greg Ewing
Gareth McCaughan wrote: > For what it's worth[1], I think Raymond is absolutely on crack here. +1 on a good concrete set API from me, too. Being such similar types, sets should have about the same API richness as dicts, IMO. -- Greg ___ Py

Re: [Python-Dev] Class decorators

2006-03-28 Thread Greg Ewing
s no discussion of the issue at all. Seems to me that, since we now already have @-decorators for functions, a *very* good reason will be needed for requiring a completely different syntax to get exactly the same effect for classes. -- Greg ___ Python-D

Re: [Python-Dev] Class decorators

2006-03-29 Thread Greg Ewing
ion is hoopy" @def biguglydecorator(longconvolutedarglist) Someone is going to object that the evaluation time and environment of the decorator is screwy. But I don't care. :-) Greg ___ Python-Dev mailing list Python-Dev@python.o

Re: [Python-Dev] INPLACE_ADD and INPLACE_MULTIPLY oddities in ceval.c

2006-03-29 Thread Greg Ewing
Armin Rigo wrote: > So if we provide a complete fix, [].__add__(x) will be modified to > return NotImplemented instead of raising TypeError if x is not a list, > and then [1,2,3]+array([4,5,6]) will fall back to array.__radd__() as > before. Ah, okay. That seems like it would wo

Re: [Python-Dev] INPLACE_ADD and INPLACE_MULTIPLY oddities in ceval.c

2006-03-29 Thread Greg Ewing
the conceptual notion that a += b is equivalent to a = a + b when a can't be modified in-place. Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman

[Python-Dev] Name for python package repository

2006-03-29 Thread Greg Ewing
I just thought of a possible name for the Python package repository. We could call it the PIPE - Python Index of Packages and Extensions. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam

Re: [Python-Dev] pysqlite for 2.5?

2006-03-29 Thread Greg Ewing
evel of a reorganised package namespace, I don't think it would be out of place to reserve "db" for database stuff. It can always be renamed on import if it happens to conflict with anything in code, and I wouldn't object to not being able to have my own top-level package called &quo

Re: [Python-Dev] Class decorators

2006-03-29 Thread Greg Ewing
Phillip J. Eby wrote: > My comment above was only about readable *placement* of the decorators, not > the actual syntax. The placement is part of the syntax... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carp

Re: [Python-Dev] PySet API

2006-03-29 Thread Greg Ewing
ariable length argument list instead of a single argument). Would that really buy you anything much over just making multiple PySet_Update() calls? Is it just syntactic sugar, or is there some optimisation you can do with multiple updates presented all at once? -

Re: [Python-Dev] Class decorators

2006-03-29 Thread Greg Ewing
d you provide this information? Still want class decorators, though. :-) BTW, the system I'm working on is a response to some hair-tearing problems I was experiencing trying to pickle some of my data, and also to address some disadvantages I see in using pickle for long-term data storage. I'

Re: [Python-Dev] pysqlite for 2.5?

2006-03-29 Thread Greg Ewing
with concurrency or large amounts of data that I know of. In fact, a Firebird interface might be an alternative worth considering for the library. It would have most of the advantages of SQLite without these disadvantages. -- Greg Ewing, Computer Science Dept, +--

Re: [Python-Dev] pysqlite for 2.5?

2006-03-29 Thread Greg Ewing
the hierarchy completely and going relational. Maybe a single dotted hierarchy of package names is too restrictive? Should we be able to import things by specifying attributes instead of a pathname? import db where db.stdlib == True and db.language == "SQL" \ and db.interface

Re: [Python-Dev] Class decorators

2006-03-29 Thread Greg Ewing
want them inherited) for large amounts of information that wouldn't comfortably fit up the top. That's an extra degree of freedom that we don't have with functions. - - - - - [1] Actually I would probably give it one optional argument, the name to register

Re: [Python-Dev] pysqlite for 2.5?

2006-03-29 Thread Greg Ewing
[EMAIL PROTECTED] wrote: > Greg> There's a big difference between "db" and "em": "db" is an > Greg> extremely well-known abbreviation, whereas "em" isn't. > > Unless you're a typesetter or a TeX hound... :-) Good p

Re: [Python-Dev] pysqlite for 2.5?

2006-03-29 Thread Greg Ewing
Fred L. Drake, Jr. wrote: > On Wednesday 29 March 2006 21:55, Greg Ewing wrote: > >import db where db.stdlib == True and db.language == "SQL" \ > > and db.interface == "DBAPI2.0" > > While we're at it, we could spell import "select

Re: [Python-Dev] Class decorators

2006-03-30 Thread Greg Ewing
I've been thinking about an 'instance' statement that creates an instance of a class: instance my_thing(MyClass): # attribute assignments go here -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/m

Re: [Python-Dev] Class decorators

2006-03-30 Thread Greg Ewing
One issue is that I'm also abusing a class statement to create a namespace for my extra info. Inserting that as a decorator argument obviously wouldn't be possible... -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.py

Re: [Python-Dev] building sql queries in python

2006-03-30 Thread Greg Ewing
Boolean Operators PEP, by the way.) I'd like to see some way of attacking this problem head-on, rather than endlessly looking for convoluted ways around it. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman

Re: [Python-Dev] Class decorators

2006-03-30 Thread Greg Ewing
gs with attribute access when the attribute is a descriptor. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] pysqlite for 2.5?

2006-03-30 Thread Greg Ewing
Fredrik Lundh wrote: > Greg Ewing wrote: > > > Firebird could be a solution to this. > > so a library that doesn't support multiple independent > readers/writers on a single file at all is much better > than one that does, Where do you get that from? Firebird supp

Re: [Python-Dev] pysqlite for 2.5?

2006-03-30 Thread Greg Ewing
tabase, embedded or otherwise, to give it a go. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] pysqlite for 2.5?

2006-03-30 Thread Greg Ewing
tart using stuff from the new db package, he would just have to rename his module. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-03-30 Thread Greg Ewing
tes: > obj.__del__() I think we need to be very careful about doing anything like this. From what Tim said recently, the consequences of an object getting its __del__ annotation wrong could be as bad as crashing the interpreter. -- Greg ___

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-03-31 Thread Greg Ewing
e memory leaks, through no fault of my own and without my being able to do anything about it. Will there be a coding practice one can follow to ensure that this doesn't happen? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-03-31 Thread Greg Ewing
avoid leaking memory. I'm becoming more and more convinced that we desperately need something better than __del__ methods to do finalisation. A garbage collector that can't be relied upon to collect garbage is simply not acceptable. -- Greg ___

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-04-03 Thread Greg Ewing
Michael Hudson wrote: > And if we want to have a version of __del__ that can't reference > 'self', we have it already: weakrefs with callbacks. Does that actually work at the moment? Last I heard, there was some issue with gc and weakref callbacks as well. Has that been reso

Re: [Python-Dev] [Python-checkins] r43545 - in python/trunk: Doc/lib/libcalendar.tex Lib/calendar.py

2006-04-03 Thread Greg Ewing
Walter Dörwald wrote: > OK, the property setter does a "% 7" now. (But the global > setfirstweekday() still does a range check). Wouldn't it be better for the setter to raise an exception if it's out of range? It probably indicates a bug in the caller's code. -

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-04-03 Thread Greg Ewing
ere so that the callback is reachable, that references enough stuff to clean up after the generator, without referencing the generator itself? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | C

Re: [Python-Dev] [Python-checkins] r43545 - in python/trunk: Doc/lib/libcalendar.tex Lib/calendar.py

2006-04-04 Thread Greg Ewing
Walter Dörwald wrote: > Greg Ewing wrote: > >> Wouldn't it be better for the setter to raise an exception >> if it's out of range? It probably indicates a bug in the >> caller's code. > > The day before Monday is -1, so it adds a little convenience.

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-04-04 Thread Greg Ewing
ry I'm distributing, I can't be sure people won't put them in cycles. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-04-04 Thread Greg Ewing
Neil Schemenauer wrote: > I think so but it depends on what the finalizer needs to reference. That's really what I'm asking -- what *does* a generator finaliser need to reference? Or does it depend on what the generator's code does? -- Greg

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-04-04 Thread Greg Ewing
operations. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] reference leaks, __del__, and annotations

2006-04-04 Thread Greg Ewing
Martin v. Löwis wrote: > Of this kind, we have several spare bits: there are atleast two bits > in the ob_type field, And that would require changing all code that dereferenced the ob_type field! This would be much worse -- at least Py_INCREF and Py_DECREF are macros... -

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Greg Ewing
don't want this, I'm happy to write isinstance(c, type) and issubclass(c, d) > B) issubclass() won't work on a list of classs, > the way isinstance() does. That sounds more reasonable. I can't think of any reason why it shouldn't work. -- Greg ___

Re: [Python-Dev] tally (and other accumulators)

2006-04-05 Thread Greg Ewing
Jess Austin wrote: > I'll go > so far as to suggest that the existence of groupby() obviates the > proposed tally(). Except that it requires building a list of values in each group when all you want at the end is the length of the

[Python-Dev] elementtree in stdlib

2006-04-05 Thread Greg Ewing
ee containing a module called ElementTree containing a class called ElementTree is just too confusing for words! -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Greg Ewing
naming of things added to the stdlib, consistency of naming is never going to improve. Or should this wait for Py3k? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiam! | Christchurch, New

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Greg Ewing
e or cElementTree or \ elementtree.ElementTree or lxml.etree as ET -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

<    17   18   19   20   21   22   23   24   25   >