Re: What about an EXPLICIT naming scheme for built-ins?
From: Jp Calderone (exarkun_at_divmod.com)
Date: 09/03/04
- Next message: Jp Calderone: "Re: print with no newline"
- Previous message: 510046470588-0001_at_t-online.de: "Re: Xah Lee's Unixism"
- Maybe in reply to: Marco Aschwanden: "What about an EXPLICIT naming scheme for built-ins?"
- Next in thread: Alex Martelli: "Re: What about an EXPLICIT naming scheme for built-ins?"
- Reply: Alex Martelli: "Re: What about an EXPLICIT naming scheme for built-ins?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 03 Sep 2004 10:05:43 -0400 To: python-list@python.org
Carlos Ribeiro wrote:
> Mostly agreed. There is an inconsistence, as sorted() and reversed()
> should return both the same type of result - be it a sequence or a
> iterator.
>
> I propose a slightly different approach. First, proposing a generic
> naming scheme for built-ins is an ambitious goal, to say the least. I
> suggest to keep the focus on this particular issue, if only to avoid a
> lot of debate and flaming. So -- keeping in mind my own suggestion --
> I would like to focus on the particular case at hand:
>
> 1) sorted() and reversed() should return sequences. So sorted() stays
> like it, and reversed() meaning is changed. Now, that could
> potentially break a lot of code, but probably this is not going to
> happen -- because in most situations, reversed() is getting called
They are new. There is no reason to worry about breaking
compatibility. Why sequences and not iterators? I would prefer the
latter, and it is in keeping with many other recent language
developments (generator comprehensions, itertools module, etc).
>
> 2) add two new builtins, called respectively xsorted() and
> xreversed(), as the iterator versions of sorted() and reversed(). This
> way we keep the existing naming convention for range() and xrange().
-1. The "x" prefix means "this is a hack". xrange() will become
range() in Python 3.0. The xreadlines module is deprecated already.
Jp
- Next message: Jp Calderone: "Re: print with no newline"
- Previous message: 510046470588-0001_at_t-online.de: "Re: Xah Lee's Unixism"
- Maybe in reply to: Marco Aschwanden: "What about an EXPLICIT naming scheme for built-ins?"
- Next in thread: Alex Martelli: "Re: What about an EXPLICIT naming scheme for built-ins?"
- Reply: Alex Martelli: "Re: What about an EXPLICIT naming scheme for built-ins?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|