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 >>

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

2006-02-21 Thread Bengt Richter
o extend named namespaces with new names, function locals being slotted in a fixed space tied into the frame (I think). But there are tricks I guess. Anyway, I hadn't seen this idea before. Seems Regards, Bengt Richter > >On 2/20/06, Almann T. Goo <[EMAIL PROTECTED]> wrote: &

[Python-Dev] Memory Error the right error for coding cookie promise violation?

2006-02-20 Thread Bengt Richter
Perhaps a more informative message would be nice. Here's an easy way to trigger it: >>> compile("#-*- coding: ascii -*-\nprint 'ab%c'\n"%0x80, '','exec') Traceback (most recent call last): File

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Bengt Richter
think of that one^H^H^Hzero ;-) I used it in the examples above ;-) Here is the code (be kind ;-) < dd.py >--- class DD(dict): def __pow__(self, factory): class proxy(object): def __init__(self, dct, factory):

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

2006-02-20 Thread Bengt Richter
popups for the additional material would be cool. It would mean automatically editing the doc to insert the hints though. Well, nothing there is rocket science, but neither is a wall of bricks so long and high you can't live long enough to complete it ;-) Regards, Bengt Richter _

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Bengt Richter
ory if active, and if not active, it would still act, letting you instrument a "normal" dict with special effects. Of course, if you wanted to write an on_missing handler to use default_factory like your original example, you could. So on_missing would

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

2006-02-20 Thread Bengt Richter
ncode/decode methods*, not the codec system. I would have been fine with >another set of methods for non-unicode transformations. Although I would >have been even more fine if they got their encoding not as a string, but as, >say, a module object, or something imported from a module. > &

[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
7;) internally, or it might do eager conversion per optional additional args. Certainly .bmp without rle can be hugely wasteful. For flexibility like eager vs not, or perhaps returning an iterator instead of a byte sequence, I guess the encode/decode signatures should be (enc, *args, **kw) and

Re: [Python-Dev] Proposal: defaultdict

2006-02-18 Thread Bengt Richter
t; OTOH, I forgot why it was desirable in the first place to overload d[k] with defaulting logic. E.g., why wouldn't d.defaulting[k] be ok to write when you want the d.default_factory action? on_missing feels more like a tracing hook though, so maybe 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.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()

2006-02-17 Thread Bengt Richter
text(b_tgz, 'gunzip') would produce unicode text with a special internal representation that just wraps bytes though they are true unicode. The 'bytes' codec encode of course would just unwrap the internal bytes representation, but it would conceptually be an encoding into bytes. bytes(t, 'latin-1') would produce the same output from the wrapped bytes unicode. Sometimes conceptual purity can clarify things and sometimes it's just another confusing description. 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] Proposal: defaultdict

2006-02-17 Thread Bengt Richter
.defaults_enabled) as that could allow e.g. foo(**kw) more options in how to copy kw and what foo could do. Would total copy including defaulting state be best? What other copies must be sanitized? type('Foo',(), **{'this':'one?'}) It will be interesting to see wha

Re: [Python-Dev] Serial function call composition syntax foo(x, y) -> bar() -> baz(z)

2006-02-17 Thread Bengt Richter
Is that a record? ;-) BTW, does python-dev have different expectations re top-posting? I've seen more here than on c.l.p I think, so I'm wondering what to do. When-in-Rome'ly, Regards, Bengt Richter On Fri, 17 Feb 2006 14:17:41 -0800, "Guido van Rossum" <[EMAIL PROT

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

2006-02-17 Thread Bengt Richter
reliable. It's no fun when your NFS server goes down and your >machine hangs because someone wanted to save 50 MB per workstation by >sharing it. > Sometimes a separate mount could be a separate hard disk in the same box, I guess. Apparently it's read-only, so I guess it cou

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

2006-02-17 Thread Bengt Richter
encode. And the hidden stuff restricts to ascii, for further grief :-( So 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] Serial function call composition syntax foo(x, y) -> bar() -> baz(z)

2006-02-17 Thread Bengt Richter
ed call. I.e., 'abcd' -> binascii.hexlify() for >>> new.instancemethod(binascii.hexlify, 'abcd', str)() '61626364' Note that it's valid to leave off the () -- IOW simply, a->b is sugar for b.__

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Bengt Richter
n True if there is a default. That seems iffy. ISTM potential should not define actual status. Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.

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

2006-02-17 Thread Bengt Richter
(x,y) ... >>> def bar(stream): return 'bar(%s)'%stream ... >>> def baz(stream, z): return 'baz(%s, %s)'%(stream,z) ... >>> x = 'ex'; y='wye'; z='zed' >>> baz.__get__(bar.__get__(foo(x, y))())(z) 'ba

Re: [Python-Dev] bytes type discussion

2006-02-17 Thread Bengt Richter
e's no way to count to 10 if you only have one digit? >> >> we used to think that back 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 ambi

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-17 Thread Bengt Richter
n with this, since I anticipate that bytes.translate would be a useful thing in the absence of str.translate. unicode.translate won't do all one might like to do with bytes.translate, I believe. Both have uses. > >BTW, for folks who want to experiment, it's quite simple to create a

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Bengt Richter
me more design subtleties: > >- "key in d" still returns False if the key isn't there >- "d.get(key)" still returns None if the key isn't there >- "d.default" should be a read-only attribute giving the default value > >Feedback? > See

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

2006-02-17 Thread Bengt Richter
esired, e.g. by s_str.translate(unichartable256, strdelchrs).translate(uniord_to_ustr_or_uniord_mapping). (e.g., the latter permits single to multiple-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 no

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

2006-02-16 Thread Bengt Richter
word opts for simple common record chunking also? in places where you might now have to have (untested) (ord(x) for x in iter(lambda f=open('path','rb'):f.read(1)) if x) or write a helper like def by_byte_ords(path, bufsize=8192): f = open(path, 'rb')

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

2006-02-15 Thread Bengt Richter
turn has an __or__ to do similarly. Just had this bf, but ISTM it reads ok. The equivalent nested generator expression with same assumed primitives would I guess be for line in decoder('latin-1')(linechunker(binaryfile('path'))): ... which doesn't have the same natu

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
st): File "", line 1, in ? TypeError: int() expected a byte, but bytes of length 2 found I've hacked a few pieces, but I think further discussion either in this thread or maybe a bytes prototype spec thread would be fruitful.

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
you don't have to think about encoding, just use ord/unichr in range(0,256). Hex escapes within unicode strings work as expected, so IMO it's pretty clean. I think I have shown this in a couple of other posts in the orignal thread (where I created and compiled source code in several enco

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
n range(0,256) will do. > >Martin von Loewis's alternative for the "very controversial" set is to >disallow an encoding argument and (I believe) also to disallow Unicode >arguments. In 3.0 this would leave us with s.encode() as the >only way to convert a string (which is always unicode) to bytes. The >problem with this is that there's no code that works in both 2.x and >3.0. > I hope Martin will reconsider, considering ord/unichr as a symmetric pair of functions mapping 1:1 to unicode (and ignoring the fact that this also happens to be the latin-1 mapping ;-) A test class should be easy, except 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-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] PEP 332 revival in coordination with pep 349? [ Was:Re: release plan for 2.5 ?]

2006-02-15 Thread Bengt Richter
115, 32, 246, 0, 1, 2, 255]) letting bytes accept the string with internal ord mapping seems a handy concise initialization _option_, though passing the int list is fine too. bytes(u'some chars \xf6\x00\x01\x02\xff') BTW, that could serve as a round-trippable repr, but bytes([1

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

2006-02-15 Thread Bengt Richter
irst 256 unicode characters to specify byte type values if desired. (This happens to correspond to latin-1, but don't mention it ;-) It would make possible a round-trippable repr as bytes('...') using ascii+escaped ascii, and full-256 unicode string literals backwards-compatibly after py

Re: [Python-Dev] PEP 351

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

Re: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

2006-02-11 Thread Bengt Richter
ler Version 12.00.8168 for 80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. martin.c Microsoft (R) Incremental Linker Version 6.00.8168 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /out:martin.exe martin.obj [12:34] C:\pywk\pydev>martin Foo Bar foo:Foo foo:Bar foo2:

Re: [Python-Dev] _length_cue()

2006-02-11 Thread Bengt Richter
f it, I guess I could do stuff like that in site.py, since >>> help.plaindir = lambda x: sorted([x for x in dir(x) if not >>> x.startswith('_')]) >>> help.plaindir(int) [] >>> help.plaindir([]) ['append', 'count', 'extend&

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

2006-02-11 Thread Bengt Richter
;I only found one instance of breakage in the standard library. 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 th

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

2006-02-10 Thread Bengt Richter
breakage in the standard library. 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. > Should this not be

Re: [Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

2006-02-10 Thread Bengt Richter
*'. Equivalence, in this >case, means 'can be automatically downcasted'. Peter v/d Linden explains >this quite well in "Expert C Programming" (aka 'Deep C Secrets'), but >unfortunately I'm working from home and I left my copy at a coworkers

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

2006-02-09 Thread Bengt Richter
ill try to find it and read it. But no fair tempting the weak with """ It's a hard problem ... For example, consider this hypothetical example: ... """ ;-) Regards, Bengt Richter ___ Python-Dev mailing list Pyt

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

2006-02-09 Thread Bengt Richter
On Fri, 10 Feb 2006 01:23:25 +0100, Thomas Wouters <[EMAIL PROTECTED]> wrote: >On Fri, Feb 10, 2006 at 12:16:30AM +0000, Bengt Richter wrote: >> On Thu, 9 Feb 2006 10:33:10 -0800, Guido van Rossum <[EMAIL PROTECTED]> >> wrote: >> >Enough already. > [.

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

2006-02-09 Thread Bengt Richter
ents: first list comprehensions, then >generator expressions, most recently conditional expressions, in >Python 3000 print() will become a function... Seen this way, lambda >was just ahead of its time! Perhaps we could add a try/except/finally >expression, and allow assignments in exp

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
ll obj.__int__() if passed a non-(int,long) obj ? Would that cover your use case? BTW the slice type happily accepts anything 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 t

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

2006-02-09 Thread Bengt Richter
ly spelling of !(x:3+5*x) Hm, are the latter two really better for eliminating "lambda"? Cf: sorted(seq, key=(lambda x:: try:return abs(x) except 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

Re: [Python-Dev] _length_cue()

2006-02-09 Thread Bengt Richter
erson I can believe that >"cue", "queue" and "kew" might mean exactly the same thing... > FWIW, I first thought "cue" might be a typo mutation of "clue" ;-) +1 on something with "hint". Regards, Bengt Richter _

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

2006-02-09 Thread Bengt Richter
b(4) 'No name for 4 -- IndexError:list index out of range' >>> lamb('x') "No name for 'x' -- TypeError:list indices must be integers" But would e.g. [1] collection.visit(lambda x:: # double ':' to signify suite start try

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)

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 +0000, Bengt Richter wrote: > >> Perhaps I missed a py3k assumption in this thread (where I see in the PEP >> that "Remove distinction between int and lo

Re: [Python-Dev] Octal literals

2006-02-05 Thread Bengt Richter
On Sun, 05 Feb 2006 18:47:13 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote: > >[EMAIL PROTECTED] (Bengt Richter) wrote: >> Are you just lecturing me personally (in which case off list would be more >> appropriate), >> or do you include the authors of the 17 fil

Re: [Python-Dev] Octal literals

2006-02-05 Thread Bengt Richter
On Sun, 5 Feb 2006 18:08:58 -0800, Guido van Rossum <[EMAIL PROTECTED]> wrote: >On 2/5/06, Bengt Richter <[EMAIL PROTECTED]> wrote: >> On Sun, 05 Feb 2006 09:38:35 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote: >> >1. If your Python code distinguishes betw

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

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

2006-02-05 Thread Bengt Richter
at don't come off. To misquote Einstein: The language should be as >simple >as possible, but no simpler. > ++1 QOTW Regards, Bengt Richter ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

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

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

2006-02-05 Thread Bengt Richter
s >> changed his >> mind, we'll simply need to continue with proposing functions like >> methodcaller() as workarounds for its absence... > >Yep, we'll just have to learn to live without it. :-( / ;-) If it's needed, I believe a way will be found to have it ;-)

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

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 c

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

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

2006-02-03 Thread Bengt Richter
12 LOAD_DEREF 0 (a) 15 LOAD_DEREF 1 (k) 18 CALL_FUNCTION_VAR_KW 0 21 POP_TOP 22 LOAD_CONST 0 (None) 25 RETURN_VALUE >I'll be glad to write a PEP, but I first want to

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

2006-02-03 Thread Bengt Richter
ake the syntax for deferring an expression not be >ugly anymore, now that we have generator expressions and conditionals as an >example of how to do it right". I guess you can guess my vote is for anonymous def ;-) > >Guido was rather unenthused the last time this topic came up, t

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 f

Re: [Python-Dev] Octal literals

2006-02-02 Thread Bengt Richter
an't use that. How about apostrophe as separator? 8'664 # or the suffix version could work also, although you'd have to back out of some names: 664'8 bee'16 Regards, Bengt Richter ___ Python-Dev mailing l

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

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

Re: [Python-Dev] Octal literals

2006-02-02 Thread Bengt Richter
ot;sign" bits don't force promotion to a long value: >>> bclitval('16r8004') -2147483644 [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 31 and 2 set? (assume 32-bit int for target platform, counting bit 0 as LSB and bit 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-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..

Re: [Python-Dev] Octal literals

2006-02-01 Thread Bengt Richter
s(?), it should be remembered that the '-' is mnemonic for the symbol for (radix-1), and '+' or no sign is mnemonic for a prefixed 0 (which is 0 in any allowable radix) in order to have this notation have general radix expressivity for free ;-) 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-01-31 Thread Bengt Richter
-16f7 == 1609, and -2c0110 == -6 == 2c1010 etc. This permits negative literal constants to be expressed "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 -0

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

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

2005-10-22 Thread Bengt Richter
sonable complexity. Maybe a dict could be given an option to hash all its keys as unicode vs whatever it does now. But having a charstr subtype of str would improve the "implicit" conversions to unicode IMO. Anyway, I wanted to throw in my .02USD re the implicit conversions, takin