Re: [Python-3000] threading, part 2

2006-08-11 Thread Jason Orendorff
On 8/11/06, tomer filiba <[EMAIL PROTECTED]> wrote: > why is thread.raise_exc(id, excobj) a bad API? It breaks seemingly innocent code in subtle ways. Worse, the breakage will always be a race condition, so it'll be especially hard to reproduce and debug. class Foo: ... def close(self):

Re: [Python-3000] threading, part 2

2006-08-11 Thread Jason Orendorff
On 8/11/06, Josiah Carlson <[EMAIL PROTECTED]> wrote: > Slawomir Nowaczyk <[EMAIL PROTECTED]> wrote: > > But it should not be done lightly and never when the code is not > > specifically expecting it. > > If you don't want random exceptions being raised in your threads, then > don't use this method

Re: [Python-3000] Pre-PEP: Easy Text File Decoding

2006-09-13 Thread Jason Orendorff
On 9/13/06, John S. Yates, Jr. <[EMAIL PROTECTED]> wrote: > It is a mistake on Microsoft's part to fail to strip the BOM > during conversion to UTF-8. John, you're mistaken about the reason this BOM is here. In Notepad at least, the BOM is intentionally generated when writing the file. It's not

Re: [Python-3000] BOM handling

2006-09-14 Thread Jason Orendorff
For what it's worth: in .NET, everything defaults to UTF-8, whether reading or writing. No BOM is generated when creating a new file. http://msdn2.microsoft.com/en-us/library/system.io.file.createtext.aspx Java defaults to a "default character encoding", which on Windows is the system's ANSI e

Re: [Python-3000] string C API

2006-09-15 Thread Jason Orendorff
On 9/15/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > There should be only one reference to a string until is constructed, > and after that, its data should be immutable. Recoding that results > in different bytes should not be in-place. Either it returns a new > string (no problem) or it doesn't c

Re: [Python-3000] Builtin iterator type

2006-11-16 Thread Jason Orendorff
On 11/15/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > The ending sentences though are more convincing: "...but it's a part > > of Python, and it's too late to make such fundamental changes now. > > The functions have to remain to avoid massive code breakage". That > > I c

Re: [Python-3000] Refactoring tool available (work in progress)

2006-12-15 Thread Jason Orendorff
On 12/15/06, Anders J. Munch <[EMAIL PROTECTED]> wrote: > GvR wrote: > > > > Finally, I have a dream: a GUI that will let you do this > > interactively, sort of like query-replace in Emacs. But this message > > is already too long, so I'll stop for now. Thanks for reading this > > far. :-) > > Soun

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Jason Orendorff
On Tue, Apr 1, 2008 at 9:37 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > I think it's fairly obvious why the 2.x .keys() has to change. It's > just too wasteful to actually build the list of all keys of a dictionary > (or even of all values, as you have to create all the tuples as well), >

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Jason Orendorff
On Wed, Apr 2, 2008 at 5:08 PM, Mike Klaas <[EMAIL PROTECTED]> wrote: > ...and the majority of these cases would work fine with views (input > to sorted(), etc). Suppose "the majority" here means 36 of the 46 cases. Then what you're saying is, if I write .items() without thinking, there's about

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-04 Thread Jason Orendorff
On Wed, Apr 2, 2008 at 5:48 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > In your code, how many (in absolute numbers) applications of .items() > would break when .items() becomes a view? Sorry for the slow response. Good question. In 25k lines of code (not mine but mostly written by peop

Re: [Python-3000] Recursive str

2008-04-16 Thread Jason Orendorff
On Tue, Apr 15, 2008 at 10:30 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > import unirep > > print(*map(unirep.russian, objects)) > > That's okay if the objects are strings, but what about > non-string objects that contain strings? > > We'd need another protocol, such as

Re: [Python-3000] Thoughts on dictionary views

2007-02-20 Thread Jason Orendorff
On 2/20/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > * A dict is also one of Python's most basic APIs (along with lists). Ideally, > we should keep those two APIs as simple as possible (getting rid of > setdefault() > and unneeded methods is a step in the right direction). IMO, the views w

Re: [Python-3000] Thoughts on new I/O library and bytecode

2007-02-23 Thread Jason Orendorff
On 2/22/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > If someone would like to volunteer a small PEP on the b"..." literal I > would appreciate it. I'll do this, unless someone tells me not to. A few questions. The grammar for string literals is already changing in py3k (removing the toleran

Re: [Python-3000] Thoughts on new I/O library and bytecode

2007-02-23 Thread Jason Orendorff
On 2/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote: > On 2/21/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Patch anyone? > > See attachement. It's preliminary -- it just calls the global name 'bytes' > currently (and not even using the 'right' AST concretion mechanism) which > means you ca

Re: [Python-3000] New I/O PEP to Subversion

2007-03-14 Thread Jason Orendorff
On 3/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I think we're far enough along with the new I/O PEP and trial > implementation that I'm uncomfortable with the PEP living in Google > docs only (http://docs.google.com/Doc?id=dfksfvqd_1cn5g5m). Does > someone have half an hour of time availa

Re: [Python-3000] Reminder: Py3k PEPs due by April

2007-04-11 Thread Jason Orendorff
On 4/10/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > * Eliminate implicit string concatenation: "abc" "def" > in favor of an explicit + operation. That simplifies > the grammar just a bit and the compiler already is > smart enough to do constant fold this operation at > compile time. [...]

Re: [Python-3000] Reminder: Py3k PEPs due by April

2007-04-11 Thread Jason Orendorff
On 4/11/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > But there's another Python principle here, I think... complexity of > computation should be represented by complexity of syntax. We don't > generally like to use properties for expensive computation, or methods for > simple field access, for

Re: [Python-3000] string module trimming

2007-04-19 Thread Jason Orendorff
On 4/18/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 4/18/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > On 4/18/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > > > > Today, string.letters works most easily with ASCII supersets, and is > > > effectively limited to 8-bit encodings. Once everythi

Re: [Python-3000] string module trimming

2007-04-20 Thread Jason Orendorff
On 4/19/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 4/19/07, Jason Orendorff <[EMAIL PROTECTED]> wrote: > > Collation can be done right: provide a function text.sort_key() > > that converts a str into an opaque thing that has the desired > > ordering. >

Re: [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-25 Thread Jason Orendorff
On 4/25/07, Collin Winter <[EMAIL PROTECTED]> wrote: > I can see use-cases for this level of formalism, but I'm a strong -1 > on making any part of the stdlib effectively off-limits for people > without advanced math degrees. Why can't this be shipped as a > third-party module? I agree. That last

Re: [Python-3000] PEP 3119 - Introducing Abstract Base Classes

2007-04-27 Thread Jason Orendorff
On 4/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > - Where should PartiallyOrdered and TotallyOrdered live? Could someone please post some sample code using either of these? I don't see what they're good for. Here's my failed attempt: def my_max(a : TotallyOrdered, b : TotallyOrdered):

Re: [Python-3000] Breakthrough in thinking about ABCs (PEPs 3119 and 3141)

2007-04-30 Thread Jason Orendorff
On 4/30/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > The correct > approach is for TotallyOrdered to be a metaclass (is this the > typeclass thing in Haskell?). Mmmm. Typeclasses don't *feel* like metaclasses. Haskell types aren't objects. A typeclass is like an interface, but more express

Re: [Python-3000] PEP 3124 - Overloading, Generic Functions, Interfaces, etc.

2007-05-01 Thread Jason Orendorff
On 5/1/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 09:13 AM 5/1/2007 -0700, Talin wrote: > >I don't care for the idea of testing against a specially named argument. > >Why couldn't you just have a different decorator, such as > >"overload_chained" which triggers this behavior? > > The PEP li

Re: [Python-3000] PEP 3124 - Overloading, Generic Functions, Interfaces, etc.

2007-05-01 Thread Jason Orendorff
On 5/1/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 02:22 PM 5/1/2007 -0400, Jason Orendorff wrote: > >I think I would prefer to *always* pass the next method > >to @around methods, which always need it, and *never* > >pass it to any of the others. What use cas

Re: [Python-3000] [Python-Dev] Byte literals (was Re: [Python-checkins] Changing string constants to byte arrays ( r55119 - in python/branches/py3k-struni/Lib: codecs.py test/test_codecs.py ))

2007-05-08 Thread Jason Orendorff
On 5/7/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I don't know how this will work out yet. I'm not convinced that having > both mutable and immutable bytes is the right thing to do; but I'm > also not convinced of the opposite. I am slowly working on the > string/unicode unification, and so

Re: [Python-3000] Support for PEP 3131

2007-05-13 Thread Jason Orendorff
On 5/13/07, Talin <[EMAIL PROTECTED]> wrote: > The fact that programming languages resemble a particular human language > is a pedagogical convenience, but it need not be so, and wasn't always > that way. "Crucial usability feature", not "pedagogical convenience". Choosing good names for things i

Re: [Python-3000] Unicode strings, identifiers, and import

2007-05-14 Thread Jason Orendorff
On 5/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Isn't normalization also going to be an issue with using non-ASCII in > general? Does it mean that Python will have to use a normalization > before comparing identifiers as equal? That's terrible, as it will > vastly increase the amount need

Re: [Python-3000] Support for PEP 3131

2007-05-14 Thread Jason Orendorff
On 5/13/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > I don't think this scenario is all that unlikely. A > program is initially written by a Russian programmer > who uses his own version of "a" as a variable name. > Later an English-speaking programmer makes some > changes, and uses an ascii "a". No

Re: [Python-3000] Unicode strings, identifiers, and import

2007-05-14 Thread Jason Orendorff
On 5/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Does the tokenizer do this for all string literals, too? Otherwise you > could still get surprises with things like x.foo vs. getattr(x, > "foo"), if the name foo were normalized but the string "foo" were not. It does not; so yes, you could

Re: [Python-3000] Support for PEP 3131

2007-05-14 Thread Jason Orendorff
On 5/14/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > Have you been able to find substantial Java source in which non-ascii > identifiers were used? I have been curious about its prevalence, but > wouldn't even know how to start searching for such code. No, I haven't. The most substantial use

Re: [Python-3000] Support for PEP 3131 - discussion on python zope users group

2007-05-16 Thread Jason Orendorff
On 5/16/07, Collin Winter <[EMAIL PROTECTED]> wrote: > > -> unittest - very useful to give a better overview of the result of > > unit test. People pointed us at a Visual C# MVP tutorial > > http://www.atmarkit.co.jp/fdotnet/nagile/nagile02/nagile02_03.html > > I don't know what "a better overvie

Re: [Python-3000] pep 3131 again

2007-05-17 Thread Jason Orendorff
Martin, this message suggests an addition to PEP 3131. On 5/16/07, tomer filiba <[EMAIL PROTECTED]> wrote: > === RTL/LTR === > the only practical way to use RTL languages in code is to have an RTL > programming language, where "if" is spelled "אם", "for" as "עבור", > "in" as "בתוך", and so on, and

Re: [Python-3000] [Python-Dev] Wither PEP 335 (Overloadable Boolean Operators)?

2007-05-19 Thread Jason Orendorff
On 5/18/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > While reviewing PEPs, I stumbled over PEP 335 ( Overloadable Boolean > Operators) by Greg Ewing. -1. "and" and "or" affect the flow of control. It's a matter of taste, but I feel the benefit is too small here to add another flow-control q

Re: [Python-3000] Wither PEP 335 (Overloadable Boolean Operators)?

2007-05-19 Thread Jason Orendorff
On 5/19/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Raymond Hettinger wrote: > > FWIW, the peephole optimizer takes advantage of the current meaning > > of and/or to generate faster code. > > Can you give some examples of the sort of optimisations > that are done? Look in Python/peephole.c, functi

Re: [Python-3000] PEP 3131 - the details

2007-05-21 Thread Jason Orendorff
On 5/17/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > That is my reasoning, too. People seem to want to be conservative, > so it's safer to reject formatting characters for the moment. > If people come up with a need, they still can be added. How about this: *require* the LEFT-TO-RIGHT MARK a

Re: [Python-3000] PEP 3131 accepted

2007-05-23 Thread Jason Orendorff
This discussion is off the rails again. I'm at least sympathetic to the spoofing argument, because theoretical security concerns have a way of becoming serious practical concerns overnight. But I'm not sure what to make of the rest. Other languages have had this feature for many years. The "num

[Python-3000] map, filter, reduce

2007-06-01 Thread Jason Orendorff
PEP 3100 still isn't clear on the fate of these guys, except that reduce() is gone. How about moving all three to the functools module instead? -j ___ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Un

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Jason Orendorff
On 6/1/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 6/1/07, Jason Orendorff <[EMAIL PROTECTED]> wrote: > > PEP 3100 still isn't clear on the fate of these guys, except that > > reduce() is gone. > > I'm not sure what isn't clear: reduce() is

Re: [Python-3000] Immutable bytes type and dbm modules

2007-08-09 Thread Jason Orendorff
On 8/7/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > My concern is that people need to access existing databases. It's > all fine that the code accessing them breaks, and that they have > to actively port to Py3k. However, telling them that they have to > represent the keys in their dbm disk f

Re: [Python-3000] Immutable bytes type and dbm modules

2007-08-09 Thread Jason Orendorff
On 8/9/07, Joel Bender <[EMAIL PROTECTED]> wrote: > Jason Orendorff wrote: > > Hooks would help with that, or even eliminate the need altogether. > > IMHO, having a __bytes__ method would go a long way. Well, it would go halfway--you also need to deserialize. __bytes__ alone

Re: [Python-3000] Immutable bytes type and dbm modules

2007-08-09 Thread Jason Orendorff
On 8/9/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Too true. Offhand, why not provide hooks for serializing and > > deserializing keys? > > Perhaps YAGNI? We already support pickling values (dbshelve), > and I added support for encoding/decoding strings as either > keys or values (though

Re: [Python-3000] New io system and binary data

2007-09-19 Thread Jason Orendorff
On 9/19/07, Bill Janssen <[EMAIL PROTECTED]> wrote: > > Way more programs (especially simple ones) deal with txet > > than with binary data. > > I'd love to see stats on that, Guido. I'm sure it's true in your > immediate vicinity, given what you work on, but I don't believe it's > true in general

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Jason Orendorff
One situation where a sorteddict would win is finding upper and lower bounds. This especially matters if you want to iterate over a specific range of keys: "show me all entries between 1 Jan 2007 and 1 Feb 2007" is O(N) in the number of entries in that range, not the entire data set. I think peop