Re: [Python-Dev] PEP for Better Control of Nested Lexical Scopes

2006-02-21 Thread Bengt Richter
. Seems Regards, Bengt Richter On 2/20/06, Almann T. Goo [EMAIL PROTECTED] wrote: I am considering developing a PEP for enabling a mechanism to assign to free variables in a closure (nested function). My rationale is that with the advent of PEP 227 , Python has proper nested lexical scopes

Re: [Python-Dev] defaultdict proposal round three

2006-02-21 Thread Bengt Richter
On Tue, 21 Feb 2006 05:58:52 -0800, Guido van Rossum [EMAIL PROTECTED] wrote: On 2/20/06, Bengt Richter [EMAIL PROTECTED] wrote: How about doing it as an expression, empowering ( ;-) the dict just afer creation? E.g., for d = dict() d.default_factory = list you could write

[Python-Dev] s/bytes/octet/ [Was:Re: bytes.from_hex() [Was: PEP 332 revival in coordination with pep 349?]]

2006-02-20 Thread Bengt Richter
thought: binary octets aren't numeric ;-) Regards, Bengt Richter ___ 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.from_hex() [Was: PEP 332 revival in coordination with pep 349?]

2006-02-20 Thread Bengt Richter
are made of octets that have no instrinsic numerical or character significance. See other post if interested ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Bengt Richter
[k] would only call d.default_factory if the latter was set and the key was missing even after on_missing (if present) did something (e.g., it could be logging passively). Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http

[Python-Dev] documenting things [Was: Re: Proposal: defaultdict]

2006-02-20 Thread Bengt Richter
you can't live long enough to complete it ;-) Regards, Bengt Richter ___ 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

Re: [Python-Dev] Proposal: defaultdict

2006-02-18 Thread Bengt Richter
it could always act either way if defined. Also, for those wanting to avoid lambda:42 as factory, would a callable test cost a lot? Of course then the default_factory name might require revision. Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev

[Python-Dev] str.translate vs unicode.translate (was: Re: str object going in Py3K)

2006-02-17 Thread Bengt Richter
-character substitution) I think at least a tweaked translate method for bytes would be good for py3k, and I hope we can do it for str.translate now. It it is just too handy a high speed conversion goodie to forgo IMO. Regards, Bengt Richter ___ Python-Dev

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Bengt Richter
? See above. Regards, Bengt Richter ___ 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] Pre-PEP: The bytes object

2006-02-17 Thread Bengt Richter
): return bytes(%s) % repr(list(self)) def __add__(self, other): if isinstance(other, array): return bytes(super(bytes, self).__add__(other)) return NotImplemented Cool, thanks. Regards, Bengt Richter

Re: [Python-Dev] bytes type discussion

2006-02-17 Thread Bengt Richter
when the gas price was just below 10 SEK/L, but they found a way... IIRC Guido is on record as saying There will be no Python 2.10 because I hate the ambiguity of double-digit minor release numbers, or words to that effect. Hex? Regards, Bengt Richter

Re: [Python-Dev] bytes.from_hex() [Was: PEP 332 revival in coordination with pep 349?]

2006-02-17 Thread Bengt Richter
)' Regards, Bengt Richter ___ 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] Serial function call composition syntax foo(x, y) - bar() - baz(z)

2006-02-17 Thread Bengt Richter
is sugar for b.__get__(a) (or the instancemethod equivalent) (faked) 'expr' - baz bound method ?.baz of 'expr' (actual) baz.__get__('expr') bound method ?.baz of 'expr' and then baz.__get__('expr')('zee') 'baz(expr, zee)' What do you think? Regards, Bengt Richter

Re: [Python-Dev] bytes.from_hex() [Was: PEP 332 revival in coordination with pep 349?]

2006-02-17 Thread Bengt Richter
yes, please ban string.decode and bytes.encode. And maybe introduce bytes.recode for bytes-bytes transforms? (strings don't have any codes to recode). Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman

Re: [Python-Dev] bdist_* to stdlib?

2006-02-17 Thread Bengt Richter
, so I guess it could also temporarily be a cdrom even. Regards, Bengt Richter ___ 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

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Bengt Richter
? type('Foo',(), **{'this':'one?'}) It will be interesting to see what comes out of the woodwork ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http

Re: [Python-Dev] str object going in Py3K

2006-02-16 Thread Bengt Richter
= f.read(bufsize) and plug in by_byte_ords(path) ___ BTW, bytes([]) would presumably be the file.bytes EOF? Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] PEP 332 revival in coordination with pep 349? [ Was:Re: release plan for 2.5 ?]

2006-02-15 Thread Bengt Richter
thinking single-byte ord value.). BTW, should bytes be freezable? Regards, Bengt Richter ___ 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

Re: [Python-Dev] PEP 332 revival in coordination with pep 349? [ Was:Re: release plan for 2.5 ?]

2006-02-15 Thread Bengt Richter
after py3k turns them into unicode). BTW, I posted one (I think) other post with this essential idea, and there are a lot of posts I am tempted to respond to, but I will restrain myself ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
deciding on appropriate methods and how the type should be defined. It's the same peculiar problem as str, i.e., length one would be compatible with int, but not other lengths. How do we do that? Regards, Bengt Richter ___ Python-Dev mailing list Python

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
source code in several encodings including utf-8 and comiled with coding cookies and exec'd the result) I could always have overlooked something, but I am hopeful. Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
will mostly be writing and collecting rationale references etc. That's really not my favorite kind of work, frankly. But I like thinking and programming. Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman

Re: [Python-Dev] str object going in Py3K

2006-02-15 Thread Bengt Richter
(binaryfile('path'))): ... which doesn't have the same natural left to right reading order to match processing order. Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe

[Python-Dev] PEP 332 revival in coordination with pep 349? [ Was:Re: release plan for 2.5 ?]

2006-02-11 Thread Bengt Richter
. Note that my patch does not change PyObject_Str(); that would break massive amounts of code. Instead, I introduce a new function: PyString_New(). I'm not crazy about the name but I couldn't think of anything better. On 2/10/06, Bengt Richter [EMAIL PROTECTED] wrote: Should

Re: [Python-Dev] _length_cue()

2006-02-11 Thread Bengt Richter
', 'sort'] But some kind of standards would probably be nice for everyone if they like the general idea. I'll leave it to someone else as to whether and where a thread re help enhancements might be ok. My .02USD ;-) Regards, Bengt Richter ___ Python-Dev

Re: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

2006-02-11 Thread Bengt Richter
Regards, Bengt Richter ___ 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] Baffled by PyArg_ParseTupleAndKeywords modification

2006-02-11 Thread Bengt Richter
On Sat, 11 Feb 2006 14:14:00 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote: Bengt Richter wrote: Will a typedef help? A typedef can never help. It is always possible to reformulate a program using typedefs to one that doesn't use typedefs. I realize that's true

Re: [Python-Dev] PEP 351

2006-02-11 Thread Bengt Richter
= freeze(d) fd {'a': 1, 'b': 2} fd['a'] 1 fd['a']=3 Traceback (most recent call last): File stdin, line 1, in ? File alt351.py, line 7, in _immutable raise TypeError('object is immutable') TypeError: object is immutable type(fd) class 'alt351.imdict' +0 ;-) Regards, Bengt

Re: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

2006-02-10 Thread Bengt Richter
, for read-only access to the data? (hope I got that right). (also testing whether I have been redirected to /dev/null ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe

Re: [Python-Dev] release plan for 2.5 ?

2006-02-10 Thread Bengt Richter
of code. Instead, I introduce a new function: PyString_New(). I'm not crazy about the name but I couldn't think of anything better. Should this not be coordinated with PEP 332? Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Let's just *keep* lambda

2006-02-09 Thread Bengt Richter
above just as example, not saying it makes sense for collection.visit) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python

Re: [Python-Dev] _length_cue()

2006-02-09 Thread Bengt Richter
be a typo mutation of clue ;-) +1 on something with hint. Regards, Bengt Richter ___ 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

Re: [Python-Dev] Let's send lambda to the shearing shed (Re: Let's just *keep* lambda)

2006-02-09 Thread Bengt Richter
TypeError: return 0)) and (lambda c1,c2:lambda x:c0+c1*x)(3,5) # also silly with constants I'm not sure. I think I kind of like lambda args:expr and (lambda args::suite) but sometimes super-concise is nice ;-) 2) Remove lambda entirely. -1 Regards, Bengt Richter

Re: [Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation

2006-02-09 Thread Bengt Richter
for start:stop:step I believe, and something[slice(whatever)] will call something.__getitem__ with the slice instance, though this is neither a fast nor nicely spelled way to customize. Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] Let's just *keep* lambda

2006-02-09 Thread Bengt Richter
with It's a hard problem ... For example, consider this hypothetical example: ... ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org

Re: [Python-Dev] small floating point number problem

2006-02-08 Thread Bengt Richter
, for the OP, chasing minimum float values is probably best done with powers of 2 math.ldexp(1, -1074) 4.9406564584124654e-324 math.ldexp(1, -1075) 0.0 .5**1074 4.9406564584124654e-324 .5**1075 0.0 math.frexp(.5**1074) (0.5, -1073) math.frexp(.5**1075) (0.0, 0) Regards, Bengt Richter

Re: [Python-Dev] Octal literals

2006-02-06 Thread Bengt Richter
On Mon, 6 Feb 2006 09:05:01 +0100, Thomas Wouters [EMAIL PROTECTED] wrote: On Mon, Feb 06, 2006 at 05:33:57AM +, Bengt Richter wrote: Perhaps I missed a py3k assumption in this thread (where I see in the PEP that Remove distinction between int and long types is core item number one

Re: [Python-Dev] Octal literals

2006-02-05 Thread Bengt Richter
On Sat, 04 Feb 2006 11:11:08 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote: Bengt Richter wrote: The typical way of processing incoming ints in C is through PyArg_ParseTuple, which already has the code to coerce long-int (which in turn may raise an exception

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-05 Thread Bengt Richter
. Psst, Nick, how about (x*y for x,y in ()) ? # () as mnemonic for call args ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman

Re: [Python-Dev] Octal literals

2006-02-05 Thread Bengt Richter
On Sun, 05 Feb 2006 09:38:35 -0800, Josiah Carlson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Bengt Richter) wrote: Martin v. Lowis [EMAIL PROTECTED] wrote: Bengt Richter wrote: The typical way of processing incoming ints in C is through PyArg_ParseTuple, which already has the code

Re: [Python-Dev] math.areclose ...?

2006-02-05 Thread Bengt Richter
: The language should be as simple as possible, but no simpler. /rant ++1 QOTW Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-05 Thread Bengt Richter
On Sun, 05 Feb 2006 18:45:52 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] Psst, Nick, how about (x*y for x,y in ()) ? # () as mnemonic for call args D'oh, sorry, that should have been illegal syntax, e.g., (x*y for x,y in *) ? # * as mnemonic for call *args so (x*y for x,y

Re: [Python-Dev] Octal literals

2006-02-03 Thread Bengt Richter
On Thu, 2 Feb 2006 20:39:01 -0500, James Y Knight [EMAIL PROTECTED] wrote: On Feb 2, 2006, at 10:36 PM, Bengt Richter wrote: So long as we have a distinction between int and long, IWT int will be fixed width for any given implementation, and for interfacing with foreign functions

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-03 Thread Bengt Richter
you can guess my vote is for anonymous def ;-) Guido was rather unenthused the last time this topic came up, though, so maybe it isn't worth the effort. . . (although he did eventually change his mind on PEP 308, so I haven't entirely given up hope yet). Likewise ;-) Regards, Bengt Richter

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-03 Thread Bengt Richter
to check whether the Python-Dev crowd would just blast it out of the waters, in which case I may save writing it... -0 ;-) Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe

Re: [Python-Dev] any support for a methodcaller HOF?

2006-02-03 Thread Bengt Richter
On Fri, 03 Feb 2006 19:10:42 +0100, Christian Tismer [EMAIL PROTECTED] wrote: Bengt Richter wrote: ... BTW, re def-time bindings, the default arg abuse is a hack, so I would like to see a syntax that would permit default-arg-like def-time function-local bindings without affecting

Re: [Python-Dev] Octal literals

2006-02-03 Thread Bengt Richter
On Fri, 03 Feb 2006 19:56:20 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote: Bengt Richter wrote: If you are looking at them in C code receiving them as args in a call, treat them the same would have to mean provide code to coerce long-int or reject

Re: [Python-Dev] Octal literals

2006-02-02 Thread Bengt Richter
31 as sign). Regards, Bengt Richter ___ 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] Octal literals

2006-02-02 Thread Bengt Richter
On Thu, 2 Feb 2006 15:26:24 -0500, James Y Knight [EMAIL PROTECTED] wrote: On Feb 2, 2006, at 7:11 PM, Bengt Richter wrote: [1] To reduce all this eye-glazing discussion to a simple example, how do people now use hex notation to define an integer bit-mask constant with bits

Re: [Python-Dev] Octal literals

2006-02-02 Thread Bengt Richter
On Thu, 02 Feb 2006 23:46:00 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote: Bengt Richter wrote: [1] To reduce all this eye-glazing discussion to a simple example, how do people now use hex notation to define an integer bit-mask constant with bits

Re: [Python-Dev] Octal literals

2006-02-02 Thread Bengt Richter
out of some names: 664'8 bee'16 Regards, Bengt Richter ___ 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

Re: [Python-Dev] Octal literals

2006-02-01 Thread Bengt Richter
;-) Regards, Bengt Richter ___ 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] Octal literals

2006-02-01 Thread Bengt Richter
On Wed, 01 Feb 2006 09:47:34 -0800, Josiah Carlson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Bengt Richter) wrote: On Wed, 01 Feb 2006 12:33:36 +, Gustavo J. A. M. Carneiro [EMAIL PROTECTED] wrote: [...] Hmm.. I'm beginning to think 13r16 or 16r13 look too cryptic to the casual

Re: [Python-Dev] Octal literals

2006-01-31 Thread Bengt Richter
showing the bits as they are in two's complement or with the bits grouped to show as hex or octal digits etc. And 16cf8000 would become a 32-bit int, not a long as would -0x8000 (being a unary minus on a positive value that is promoted to long). Regards, Bengt Richter

Re: [Python-Dev] Divorcing str and unicode (no more implicit conversions).

2005-10-26 Thread Bengt Richter
At 11:43 2005-10-24 +0200, M.-A. Lemburg wrote: Bengt Richter wrote: Please bear with me for a few paragraphs ;-) Please note that source code encoding doesn't really have anything to do with the way the interpreter executes the program - it's merely a way to tell the parser how to convert

[Python-Dev] Divorcing str and unicode (no more implicit conversions).

2005-10-22 Thread Bengt Richter
on reliable inferences from source encodings of string literals or from their effects as format strings. Regards, Bengt Richter [not a normal subscriber to python-dev, so I'll have to google for any responses] ___ Python-Dev mailing list Python-Dev