Re: [Python-Dev] bool conversion wart?

2007-02-22 Thread Ben Wing
On 2/22/07, Neal Becker <[EMAIL PROTECTED]> wrote: Mike Klaas wrote: > On 2/22/07, Neal Becker <[EMAIL PROTECTED]> wrote: > >> Well consider this: >> >>>str (4) >> '4' >> >>>int(str (4)) >> 4 >> >>>str (False) >> 'False' >> >> >>>bool(str(False)) >> True >> >> Doesn't this seem a bit inconsisen

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-05 Thread Ben Wing
Fredrik Lundh wrote: > Ka-Ping Yee wrote: > > >> I'd say, don't pretend m is a sequence. Pretend it's a mapping. >> Then the conceptual issues go away. >> > > almost; that would mean returning KeyError instead of IndexError for > groups that don't exist, which means that the common patt

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-04 Thread Ben Wing
Fredrik Lundh wrote: > Martin v. Löwis wrote: > > >>> it can quickly become rather confusing if you also interpret m[:] as >>> m.groups(), not to mention if you add len() and arbitrary slicing to >>> the mix. what about m[] and m[i,j,k], btw? >>> >> I take it that you are objecting to

Re: [Python-Dev] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-03 Thread Ben Wing
Ben Wing wrote: > [interpolated strings] btw if people think this idea is good, i can certainly write it up in PEP form. ben ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: h

[Python-Dev] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

2006-12-03 Thread Ben Wing
sorry to be casting multiple ideas at once to the list. i've been looking into other languages recently and reading the recent PEP's and such and it's helped crystallize ideas about what could be better about python. i see in PEP 3101 that there's some work going on to fix up the string forma

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #1: betteriteration control

2006-12-03 Thread Ben Wing
Terry Reedy wrote: > Iterate in reverse and no index adjustment is needed > > > a good idea, thanks. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/op

Re: [Python-Dev] a feature i'd like to see in python #1: better iteration control

2006-12-03 Thread Ben Wing
Brian Harring wrote: > On Sun, Dec 03, 2006 at 08:35:58PM -0600, Ben Wing wrote: > >> but i still don't see why supporting iter.delete() is so wrong. clearly >> it doesn't need to work on files or other such things where it doesn't >> make sense. >

[Python-Dev] features i'd like [Python 3000] ... #3: fix super()

2006-12-03 Thread Ben Wing
i don't like the current super() at all. having to type super(Foo, self).__init__(...) is messy, hard to remember, and error-prone. it also introduces an unfortunate dependency in that the name of the class (Foo) has to be hard-coded in the call, and if you change the class name you also have

Re: [Python-Dev] a feature i'd like to see in python #1: better iteration control

2006-12-03 Thread Ben Wing
Brian Harring wrote: > On Sun, Dec 03, 2006 at 06:24:17AM -0600, Ben Wing wrote: > >> many times writing somewhat complex loops over lists i've found the need >> to sometimes delete an item from the list. currently there's no easy >> way to do so; basically

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-03 Thread Ben Wing
Martin v. Löwis wrote: > Aahz schrieb: > this one is fairly simple. if `m' is a match object, i'd like to be able to write m[1] instead of m.group(1). (similarly, m[:] should return the same as list(m.groups()).) this would remove some of the verbosity of regexp code, with

[Python-Dev] a feature i'd like to see in python #2: indexing of match objects

2006-12-03 Thread Ben Wing
this one is fairly simple. if `m' is a match object, i'd like to be able to write m[1] instead of m.group(1). (similarly, m[:] should return the same as list(m.groups()).) this would remove some of the verbosity of regexp code, with probably a net gain in readability; certainly no loss. ben

[Python-Dev] a feature i'd like to see in python #1: better iteration control

2006-12-03 Thread Ben Wing
many times writing somewhat complex loops over lists i've found the need to sometimes delete an item from the list. currently there's no easy way to do so; basically, you have to write something like i = 0 while i < len(list): el = list[i] ...do something... if el should be deleted: de

[Python-Dev] python syntax additions to support indentation insensitivity/generated code

2006-05-01 Thread Ben Wing
recently i've been writing code that generates a python program from a source file containing intermixed python code and non-python constructs, which get converted into python. similar things have been done in many other languages -- consider, for example, the way php is embedded into web pages

[Python-Dev] global variable modification in functions [Re: elimination of scope bleeding of iteration variables]

2006-05-01 Thread Ben Wing
Nick Coghlan wrote: > Ben Wing wrote: > >> apologies if this has been brought up on python-dev already. >> >> a suggestion i have, perhaps for python 3.0 since it may break some >> code (but imo it could go into 2.6 or 2.7 because the likely breakage >> wou

[Python-Dev] elimination of scope bleeding of iteration variables

2006-04-30 Thread Ben Wing
apologies if this has been brought up on python-dev already. a suggestion i have, perhaps for python 3.0 since it may break some code (but imo it could go into 2.6 or 2.7 because the likely breakage would be very small, see below), is the elimination of the misfeature whereby the iteration vari