[Python-Dev] Looking for new Python-Dev Summarizers

2006-12-05 Thread Steven Bethard
It's been my pleasure to write the Python-Dev Summaries for the last year and a half -- 40 summaries all told, 8 of those with Tim Lesher and 23 with Tony Meyer. It's really been an incredible learning experience, both in how the Python development process works, and in how Python as a community in

Re: [Python-Dev] [Python-3000] Warning for 2.6 and greater

2007-01-12 Thread Steven Bethard
On 1/12/07, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Jan 12, 2007, at 9:17 AM, Georg Brandl wrote: > > > Well, that is one of the cases in which that won't be possible ;) > > I think there will be at least three areas that will make porting a

Re: [Python-Dev] Unipath package

2007-01-28 Thread Steven Bethard
On 1/28/07, Michael Foord <[EMAIL PROTECTED]> wrote: > Mike Orr wrote: > > I finally finished my path package (Unipath) and put it in the Cheeseshop. > > http://sluggo.scrapping.cc/python/unipath/ > > > Hello Mike, > > Looking through the docs it looks like a great package. However, didn't > Guido

Re: [Python-Dev] A "record" type (was Re: Py2.6 ideas)

2007-02-20 Thread Steven Bethard
On 2/20/07, Larry Hastings <[EMAIL PROTECTED]> wrote: > # the easy way to define a "subclass" of record > def Point(x, y): > return record(x = x, y = y) > > # you can use hack-y features to make your "subclasses" more swell > def Point(x, y): > x = record(x = x

Re: [Python-Dev] A "record" type (was Re: Py2.6 ideas)

2007-02-21 Thread Steven Bethard
On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Declare a simple class for your type and you're ready to go:: > > >>> class Point(Record): > ... __slots__ = 'x', 'y' > ... > >>> Point(3, 4) > P

Re: [Python-Dev] datetime module enhancements

2007-03-09 Thread Steven Bethard
On 3/9/07, Collin Winter <[EMAIL PROTECTED]> wrote: > One solution that just occurred to me -- and that skirts the issue of > choosing an interpretation -- is that, when comparing date and > datetime objects, the datetime's .date() method is called and the > result of that call is compared to the o

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Steven Bethard
On 3/10/07, Jon Ribbens <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > > Using the .date() is fine when the year/month/day doesn't match. So > > the following are fine:: > > datetime.datetime(2005, 1, 1, 0, 0, 0) < datetime.d

Re: [Python-Dev] datetime module enhancements

2007-03-10 Thread Steven Bethard
On 3/10/07, Jon Ribbens <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > > I still don't see why my more careful comparison would be bad for any > > of your code. Could you give an example where it would be bad for all > > the followi

Re: [Python-Dev] datetime module enhancements

2007-03-11 Thread Steven Bethard
On 3/10/07, Jon Ribbens <[EMAIL PROTECTED]> wrote: > I see you snipped without response my request to back up your claim > that "assuming that a date() is a datetime() with a time of midnight > will clearly break that logic". > > Am I to assume you cannot back it up? I was trying to minimize the e

Re: [Python-Dev] datetime module enhancements

2007-03-11 Thread Steven Bethard
On 3/11/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > Jon Ribbens schrieb: > > I see you snipped without response my request to back up your claim > > that "assuming that a date() is a datetime() with a time of midnight > > will clearly break that logic". > > I've another idea. Date and datetim

Re: [Python-Dev] datetime module enhancements

2007-03-11 Thread Steven Bethard
On 3/11/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > I do not really understand proper temporal intervals. But I am > interested what "temporal interval logic" has to say about this > problem: > > def get_most_recent_articles(articles, cutoff_date): > recent_articles = [] > for article

Re: [Python-Dev] Adding timeout to socket.py and httplib.py

2007-03-20 Thread Steven Bethard
On 3/20/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > So, I have two modifications to make to the patch: > > - change the name to "create_connection" > - make timeout obligatory named > > Is everybody ok with this? FWLIW, +1. It was not immediately apparent to me that the third argument in::

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Steven Bethard
On 3/21/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > So, as a resume of the choices we still need to settle: > > a) Repeat the same functionality in 5 other libraries > b) Write the function in socket.py, public > c) Write the function in socket.py, non public The fact that it's needed i

Re: [Python-Dev] deprecate commands.getstatus()

2007-03-23 Thread Steven Bethard
On 3/23/07, Hrvoje Nikšić <[EMAIL PROTECTED]> wrote: > On Thu, 2007-03-22 at 13:38 -0700, Guido van Rossum wrote: > > Sounds good to me. In 3.0 we should probably not have os.popen*(), nor > > the popen2 module at all, and do everything via the subprocess module. > > I wonder if we should even get

Re: [Python-Dev] About SSL tests

2007-04-03 Thread Steven Bethard
On 4/3/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > > I'd be willing to look at adding it, if the group thinks it's the right > > thing to do. > > I like the idea and I'm proposing to add two more methods to subprocess > Popen. > > class Popen(...): > ... > def signal(self, signal): >

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Steven Bethard
Alex Martelli wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > >> Alex Martelli wrote: >> > If we had a "turn sequence into bag" function somewhere >> > (and it might be worth having it for other reasons): >> > >

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Steven Bethard
On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Here's a patch implementing collections.counts() as suggested above: > > http://bugs.python.org/1696199 > > Example usage, from the docstring:: > > >>> items = 'acabbacba' >

Re: [Python-Dev] function for counting items in a sequence

2007-04-08 Thread Steven Bethard
A summary response to the issues raised so far... On what the name should be: * Adam Olsen - countunique(), countdistinct(), countduplicates() * Greg Ewing - counteach(), countall() * Kevin Jacobs - tally() * Guido - counts() is fine So I guess I'll stick with counts(). On whether the count of a

Re: [Python-Dev] Summaries and the New Lists

2007-04-24 Thread Steven Bethard
On 4/24/07, Calvin Spealman <[EMAIL PROTECTED]> wrote: > So, the question I pose is how would everyone like to see this > resolved? As I see it, there are two things I can do. I can either > summaries each list separately, and try to sort out the cross overs. > Or, I can start pulling in all three

Re: [Python-Dev] PEP 30XZ: Simplified Parsing

2007-05-02 Thread Steven Bethard
On 5/2/07, Michael Foord <[EMAIL PROTECTED]> wrote: > Implicit string concatenation is massively useful for creating long > strings in a readable way though: > > call_something("first part\n" >"second line\n" > "third line\n") > > I find i

Re: [Python-Dev] Changing string constants to byte arrays in Py3k

2007-05-05 Thread Steven Bethard
On 5/5/07, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > On 2007-05-04 19:51, Guido van Rossum wrote: > > [-python-dev] > > > > On 5/4/07, Fred L. Drake, Jr. <[EMAIL PROTECTED]> wrote: > >> On Friday 04 May 2007, M.-A. Lemburg wrote: > >> > I also suggest making all bytes literals immutable to avoid

Re: [Python-Dev] Changing string constants to byte arrays in Py3k

2007-05-05 Thread Steven Bethard
On 5/5/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> In general, I don't think it's a good idea to have literals > >> turn into mutable objects, since literals are normally perceived > >> as being constant. > > > > Does that mean you want list literals to be immutable too? > > > > lst =

Re: [Python-Dev] The docs, reloaded

2007-05-19 Thread Steven Bethard
On 5/19/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > For the impatient: the result can be seen at . [snip] > Here's a partial list of things that have already been improved: > > - the source is much more readable (for examples, try the "view source" links > in >the le

Re: [Python-Dev] The docs, reloaded

2007-05-19 Thread Steven Bethard
On 5/19/07, Martin Blais <[EMAIL PROTECTED]> wrote: > I haven't looked at it in depth yet, but I have a question. One > concern from a long thread on Doc-Sig a long time ago, is that ReST > did not at the time possess the ability to nicely markup the objects > as LaTeX macros do. Is your transfo

Re: [Python-Dev] Are these PEP complete?: 389, 391, 3108, 3135

2011-03-26 Thread Steven Bethard
On Mon, Feb 21, 2011 at 1:52 PM, Nick Coghlan wrote: > As the subject line asks, is there anything preventing the following > PEPs from being marked Final? > >  SA  389  argparse - New Command Line Parsing Module              Bethard Sorry for taking forever to get back to this. So I looked over

Re: [Python-Dev] The docs, reloaded

2007-05-21 Thread Steven Bethard
On 5/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> One comment I have, I don't know if it's relevant - it perhaps > >> depends on whether the "Global Module Index" is auto-generated or > >> not. This is the page I visit the most out of all the Python > >> documentation,

Re: [Python-Dev] The docs, reloaded

2007-05-23 Thread Steven Bethard
On 5/23/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > Also, try > > http://pydoc.gbrandl.de:3000/os.path.exists Beautiful! STeVe -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy _

Re: [Python-Dev] What exception should Thread.start() raise?

2007-06-04 Thread Steven Bethard
On 6/4/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > The threading module contains buggy code: > > class Thread(_Verbose): > ... > def start(self): > assert self.__initialized, "Thread.__init__() not called" > assert not self.__started, "thread already started" > ...

Re: [Python-Dev] Instance variable access and descriptors

2007-06-09 Thread Steven Bethard
On 6/9/07, Eyal Lotem <[EMAIL PROTECTED]> wrote: > I believe that this should be changed, so that Python first looks for > the attribute in the instance's dict and only then through the dict's > mro. [snip] > What do you think? Are you suggesting that the following code should print "43" instead o

Re: [Python-Dev] Instance variable access and descriptors

2007-06-09 Thread Steven Bethard
> On 6/10/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > On 6/9/07, Eyal Lotem <[EMAIL PROTECTED]> wrote: > > > I believe that this should be changed, so that Python first looks for > > > the attribute in the instance's dict and only then through the

Re: [Python-Dev] itertools addition: getitem()

2007-07-08 Thread Steven Bethard
On 7/8/07, Kevin Jacobs <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: > Also vaguely apropos: > > def ilen(seq): > 'Return the length of the hopefully finite sequence' > n = 0 > for x in seq: > n += 1 > return n Also known as:: sum(1 for _ in iterable) That's always been simple

Re: [Python-Dev] Need help fixing failing Py3k Unittests in py3k-struni

2007-07-10 Thread Steven Bethard
On 7/10/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > Please help! > > I've made a meta patch that makes debugging the bugs a lot easier. It > replaces assert_(foo == bar) and failUnless(foo == bar) with > failUnlessEqual(foo, bar). failUnlessEqual shows the value of

Re: [Python-Dev] Building Python with CMake

2007-09-20 Thread Steven Bethard
On 9/20/07, Alexander Neundorf <[EMAIL PROTECTED]> wrote: > On Thursday 30 August 2007 16:28, Alexander Neundorf wrote: > ... > > The cmake files for building python are now in a cvs repository: > > http://www.cmake.org/cgi-bin/viewcvs.cgi/Utilities/CMakeBuildForPython/?roo > >t=ParaView3 Thanks f

Re: [Python-Dev] [python] Re: New lines, carriage returns, and Windows

2007-09-29 Thread Steven Bethard
On 9/29/07, Michael Foord <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > There are two normal ways for internal Python text to have \r\n: > > 1. Read from a file with \r\r\n. Then \r\r\n is correct output (on the > > same platform). > > 2. Intentially put there by a programmer. If s/he also

Re: [Python-Dev] [python] Re: New lines, carriage returns, and Windows

2007-09-29 Thread Steven Bethard
On 9/29/07, Michael Foord <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: > > On 9/29/07, Michael Foord <[EMAIL PROTECTED]> wrote: > > > >> Terry Reedy wrote: > >> > >>> There are two normal ways for internal Python text to have \r\

Re: [Python-Dev] Declaring setters with getters

2007-10-31 Thread Steven Bethard
On 10/31/07, Fred Drake <[EMAIL PROTECTED]> wrote: > If I had to choose built-in names, though, I'd prefer "property", > "propset", "propdel". Another possibility that seems reasonable > (perhaps a bit better) would be: > >class Thing(object): > >@property >def attribute(self):

Re: [Python-Dev] Declaring setters with getters

2007-11-10 Thread Steven Bethard
On Nov 10, 2007 11:31 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Unless I get negative feedback really soon I plan to submit this later > today. I've tweaked the patch slightly to be smarter about replacing > the setter and the deleter together if they are the same object. Definitely +1 on

Re: [Python-Dev] Python Library Addition: First-class Procedure Signatures

2007-11-15 Thread Steven Bethard
On Nov 14, 2007 1:18 PM, Brett Cannon <[EMAIL PROTECTED]> wrote: > On Nov 14, 2007 10:30 AM, Isaac Morland <[EMAIL PROTECTED]> wrote: > > So I wrote a Signature class. Instances of the class represent all the > > information present between the parentheses of a procedure definition. > > Properties

Re: [Python-Dev] [python] Should we do away with unbound methods in Py3k?

2007-11-21 Thread Steven Bethard
On Nov 21, 2007 4:33 PM, Michael Foord <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > I'm asking a Py3k question on python-dev because I'd like to have > > opinions from people who haven't thought about Py3k much yet. Consider > > the following example: > > > > class C: > > def fo

Re: [Python-Dev] removing the new and types modules

2007-11-28 Thread Steven Bethard
On Nov 28, 2007 2:23 PM, <[EMAIL PROTECTED]> wrote: > Sorry if this is a dumb question, but are there actually good reasons to > remove "types"? > IMHO the types module helps keeping code readable. > For example > "if type(obj) == FloatType" > is just more readable than > "if type(obj) == type(1.

Re: [Python-Dev] [poll] New name for __builtins__

2007-11-28 Thread Steven Bethard
On Nov 28, 2007 10:11 PM, Ron Adam <[EMAIL PROTECTED]> wrote: > Keeping __root__ relatively short has the benefit of being able to easily > use "__root__.name" in the case where "name" was/is used in the local > scope. I don't see any reason to make it harder. There might even be a > use case for

Re: [Python-Dev] [poll] New name for __builtins__

2007-11-30 Thread Steven Bethard
On Nov 30, 2007 4:40 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Fri, Nov 30, 2007 at 03:05:18PM -0800, Guido van Rossum wrote: > > On Nov 30, 2007 2:17 PM, Nicko van Someren <[EMAIL PROTECTED]> wrote: > > > +1 for __universal__ > > > > It's almost as if nobody has seen my proposal to leave

Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-06 Thread Steven Bethard
On Jan 6, 2008 8:33 AM, Christian Heimes <[EMAIL PROTECTED]> wrote: > * PJE: Does pkg_resource have an easy way to overwrite a package in a > name space package? E.g. an user wants to overwrite Python's > databases.sqlite with a newer version of sqlite. Can he simply do it by > inserting a package

Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-06 Thread Steven Bethard
On Jan 6, 2008 11:34 AM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: > > Do we really want to encourage this? Wouldn't that just introduce > > more pyxml-like nightmares? I've been bitten way too many times by > > pyxml overwritin

Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-06 Thread Steven Bethard
On Jan 6, 2008 1:07 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 12:03 PM 1/6/2008 -0700, Steven Bethard wrote: > >Maybe the situation is different here, but having someone installing a > >different version of sqlite behind my back makes me nervous. > > Er, some

Re: [Python-Dev] misbehaving __contains__

2008-01-22 Thread Steven Bethard
On Jan 22, 2008 5:40 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Daniel Stutzbach] > > There are many places in the C implementation where a slot > > returns an int rather than a PyObject. There other replies > > in this thread seem to support altering the signature of the > > slot to retu

Re: [Python-Dev] Simple syntax proposal: "not is"

2008-01-25 Thread Steven Bethard
On Jan 25, 2008 9:13 AM, Jameson Chema Quinn <[EMAIL PROTECTED]> wrote: > I'm writing a source code editor that translates identifiers and keywords > on-screen into a different natural language. This tool will do no > transformations except at the reversible word level. There is one simple, > avoid

Re: [Python-Dev] Compiler used to build Python for Windows

2008-03-04 Thread Steven Bethard
On Tue, Mar 4, 2008 at 5:10 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Christian Heimes wrote: > > Bob Kline wrote: > >> Any possibility of revisiting this question (upgrading to a more recent > >> compiler for Windows builds of Python)? > > > > The latest alphas of Python 2.6 and 3.0 are b

Re: [Python-Dev] Checking for the -3 flag from Python code

2008-03-20 Thread Steven Bethard
On Wed, Mar 19, 2008 at 5:51 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > This flag is exposed to python code as sys.flags.py3k_warning > > So the hack added to some of the test code that I saw go by on > python-checkins isn't needed :) Excellent. I asked around at the sprints and everyone tho

[Python-Dev] Making sys.py3k_warning writable

2008-03-22 Thread Steven Bethard
Right now, test_py3kwarn only runs if the test suite is run using the -3 command line flag to Python. So for most regrtest runs (e.g. the buildbots) this test will never be run. It would be nice to be able to turn the flag on from Python (e.g. within test_py3kwarn). Is that possible? Here's what

Re: [Python-Dev] Making sys.py3k_warning writable

2008-03-23 Thread Steven Bethard
On Sat, Mar 22, 2008 at 2:58 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: > > Right now, test_py3kwarn only runs if the test suite is run using the > > -3 command line flag to Python. So for most regrtest runs (e.g. the > > b

[Python-Dev] Fixing code that produces -3 warnings in the Python 2.6 stdlib

2008-03-23 Thread Steven Bethard
On Sun, Mar 23, 2008 at 3:02 PM, "Martin v. Löwis" wrote: [talking about running the buildbots using the -3 flag to issue Py3K warnings] > Yes. I don't think it should be turned on regularly in the tests until > they regularly are quiet under -3. So the plan is to silence all Py3K warnings in th

Re: [Python-Dev] fixing tests on windows

2008-04-01 Thread Steven Bethard
On Tue, Apr 1, 2008 at 12:42 AM, Neal Norwitz <[EMAIL PROTECTED]> wrote: > The Windows buildbots are still failing because some tests keep files > opened. This causes subsequent tests which use the same file to fail. > > Here is a recent run which had a failure early on: > > http://www.python.

Re: [Python-Dev] fixing tests on windows

2008-04-01 Thread Steven Bethard
On Tue, Apr 1, 2008 at 10:20 AM, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2008/4/1, Tim Golden <[EMAIL PROTECTED]>: > > If this is the thing to do, presumably test_support should > > grow a "remove_file" which does something of this sort? > > +1 (I was thinking exactly that). +1 here too.

Re: [Python-Dev] fixing tests on windows

2008-04-03 Thread Steven Bethard
On Thu, Apr 3, 2008 at 3:09 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > "Tim Golden" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > | [re tests which fail because something's holding a file > | open with SHARE_DELETE] > > There are a couple of things one can do in a director

Re: [Python-Dev] [Distutils] how to easily consume just the parts of eggs that are good for you

2008-04-09 Thread Steven Bethard
On Wed, Apr 9, 2008 at 4:48 PM, Paul Moore <[EMAIL PROTECTED]> wrote: > On 09/04/2008, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > It would be, if .eggs were a packaging format, rather than a binary > > distribution/runtime format. > > > > Remember "eggs are to Python as jars are to Java" -

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-20 Thread Steven Bethard
On Sun, Apr 20, 2008 at 4:15 PM, Tarek Ziadé <[EMAIL PROTECTED]> wrote: > I have submitted a patch for review here: http://bugs.python.org/issue2663 > > glob-style patterns or a callable (for complex cases) can be provided > to filter out files or directories. I'm not a big fan of the sequence-o

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-22 Thread Steven Bethard
On Tue, Apr 22, 2008 at 1:56 AM, Tarek Ziadé <[EMAIL PROTECTED]> wrote: > On Mon, Apr 21, 2008 at 2:25 AM, Steven Bethard <[EMAIL PROTECTED]> wrote: > > On Sun, Apr 20, 2008 at 4:15 PM, Tarek Ziadé <[EMAIL PROTECTED]> wrote: > > > I have submit

Re: [Python-Dev] subprocess insufficiently platform-independent?

2008-08-25 Thread Steven Bethard
On Mon, Aug 25, 2008 at 11:30 AM, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Aug 25, 2008, at 1:13 PM, Guido van Rossum wrote: > >> Several people at Google seem to have independently discovered that >> despite all of the platform-independent goodness in subprocess.py, you >> still need to be pla

Re: [Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

2008-09-29 Thread Steven Bethard
On Mon, Sep 29, 2008 at 6:07 AM, Victor Stinner <[EMAIL PROTECTED]> wrote: > The default behaviour should be to use unicode and raise an error if > conversion to unicode fails. It should also be possible to use bytes using > bytes arguments and optional arguments (for getcwd). > > - listdir(unicod

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Steven Bethard
On Mon, Jan 19, 2009 at 7:10 AM, Gerald Britton wrote: > PEP: 3142 > Title: Add a "while" clause to generator expressions [snip] > numbers in that range. Allowing for a "while" clause would allow > the redundant tests to be short-circuited: > > g = (n for n in range(100) while n*n < 50) >

Re: [Python-Dev] PEP 374 (DVCS) now in reST

2009-01-23 Thread Steven Bethard
On Fri, Jan 23, 2009 at 12:06 PM, "Martin v. Löwis" wrote: >> import random >> print(random.choice('svn', 'bzr', 'hg', 'git')) > > Nice! So it's bzr, as my machine just told me (after adding > the square brackets). Wow, that decision was a lot easier than I thought it would be. ;-) Steve

Re: [Python-Dev] Python 3.0.1 (io-in-c)

2009-01-28 Thread Steven Bethard
On Wed, Jan 28, 2009 at 10:29 AM, "Martin v. Löwis" wrote: > Notice that the determination of the specific encoding used is fairly > elaborate: > - if IO is to a terminal, Python tries to determine the encoding of > the terminal. This is mostly relevant for Windows (which uses, > by default, the

Re: [Python-Dev] Missing operator.call

2009-02-04 Thread Steven Bethard
On Wed, Feb 4, 2009 at 10:25 AM, Brett Cannon wrote: > On Wed, Feb 4, 2009 at 05:35, Hrvoje Niksic wrote: >> Andrew Bennetts wrote: >>> >>> A patch to add operator.caller(*args, **kwargs) may be a good idea. Your >>> example would then be: >>> >>>map(operator.caller(), lst) >> >> Regarding t

Re: [Python-Dev] Missing operator.call

2009-02-04 Thread Steven Bethard
On Wed, Feb 4, 2009 at 10:50 AM, Brett Cannon wrote: > On Wed, Feb 4, 2009 at 10:43, Steven Bethard wrote: >> Not sure I follow you here. It's not the __init__ that allows you to >> do ``x()``, it's the fact that the class declares a __call__, right? >> >>

[Python-Dev] adding key argument to min and max

2004-12-01 Thread Steven Bethard
This is my first post to Python dev, so I figured I should introduce myself. My name's Steven Bethard and I'm a computer science Ph.D. student at the University of Colorado at Boulder working primarily in the areas of natural language processing and machine learning. During my underg

Re: [Python-Dev] adding key argument to min and max

2004-12-01 Thread Steven Bethard
Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Steven Bethard] > > For Python 2.5, I'd like to add a keyword argument 'key' to min and > > max like we have now for list.sort and sorted. > . . . > > This means that a 'key' > > argumen

Re: [Python-Dev] PEP 246, redux

2005-01-12 Thread Steven Bethard
On Wed, 12 Jan 2005 16:07:37 -0600, Ian Bicking <[EMAIL PROTECTED]> wrote: > One case occurred to me with the discussion of strings and files, i.e., > adapting from a string to a file. Let's say an IReadableFile, since > files are too ambiguous. > > Consider the case where we are using a path obje

Re: [Python-Dev] Re: PEP 246: LiskovViolation as a name

2005-01-12 Thread Steven Bethard
On Wed, 12 Jan 2005 19:49:06 -0500, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > So the *only* way you can see > this error is if you call __conform__ directly, and somebody added code > like this: > > raise LiskovViolation > > So, it's not something you need to worry about a newbie seeing.

Re: [Python-Dev] PEP 246: lossless and stateless

2005-01-14 Thread Steven Bethard
On Fri, 14 Jan 2005 19:02:52 -0500, Glyph Lefkowitz <[EMAIL PROTECTED]> wrote: > On Fri, 2005-01-14 at 10:07 -0500, Phillip J. Eby wrote: > > > Maybe I'm missing something, but for those interfaces, isn't it okay to > > keep the state in the *adapted* object here? In other words, if PointPen > > j

Re: [Python-Dev] Allowing slicing of iterators

2005-01-25 Thread Steven Bethard
Nick Coghlan wrote: > In the example below (printing the first 3 items of a sequence), the fact that > sorted() produces a new iterable list, while reversed() produces an iterator > over the original list *should* be an irrelevant implementation detail from > the > programmer's point of view. You

Re: [Python-Dev] Allowing slicing of iterators

2005-01-25 Thread Steven Bethard
Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > FWIW, someone (Bengt Richter perhaps) once suggested syntactic support > differentiated from sequences but less awkward than a call to > itertools.islice(). > > itertools.islice(someseq, lo, hi) would be rendered as someseq'[lo:hi]. Just to make s

Re: [Python-Dev] Patch review: [ 1094542 ] add Bunch type to collections module

2005-01-26 Thread Steven Bethard
Alan Green <[EMAIL PROTECTED]> wrote: > Steven Bethard is proposing a new collection class named Bunch. I had > a few suggestions which I attached as comments to the patch - but what > is really required is a bit more work on the draft PEP, and then > discussion on the pytho

Re: [Python-Dev] Re: Patch review: [ 1094542 ] add Bunch type to collections module

2005-01-27 Thread Steven Bethard
Fernando Perez <[EMAIL PROTECTED]> wrote: > > Alan Green <[EMAIL PROTECTED]> wrote: > >> Steven Bethard is proposing a new collection class named Bunch. I had > >> a few suggestions which I attached as comments to the patch - but what > >> is really

Re: [Python-Dev] Re: Re: Patch review: [ 1094542 ] add Bunch type to collections module

2005-01-27 Thread Steven Bethard
Fernando Perez wrote: > Steven Bethard wrote: > > I'm probably not willing to budge much on adding dict-style methods -- > > if you want a dict, use a dict. But if people think they're > > necessary, there are a few methods from Struct that I wouldn't be too &

Re: [Python-Dev] Re: Re: Re: Patch review: [ 1094542 ] add Bunch type to collections module

2005-01-27 Thread Steven Bethard
On Thu, 27 Jan 2005 18:31:55 -0700, Fernando Perez <[EMAIL PROTECTED]> wrote: > However, I think it would perhaps be best to advertise any methods of Bunch as > strictly classmethods from day 1. Otherwise, you can have: > > b = Bunch() > b.update(otherdict) -> otherdict happens to have an 'update

Re: [Python-Dev] PEP 309

2005-02-26 Thread Steven Bethard
On Sat, 26 Feb 2005 19:26:11 -0500, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Are you sure about that? Contriving examples is easy, but download a > few modules, scan them for use cases, and you may find, as I did, that > partial() rarely applies. The argument order tends to be problematic.

Re: [Python-Dev] Re: [Python Dev] PEP 309

2005-02-28 Thread Steven Bethard
Peter Harris <[EMAIL PROTECTED]> wrote: > However, I sympathise with anyone who feels unhappy about a new module > just for what amounts to one function. Well, since it seems that the emphasis in Python development is now moving more towards expanding the standard library, a module that has only o

[Python-Dev] assigning a custom mapping type to __dict__

2005-03-02 Thread Steven Bethard
I think the behavior when supplying a custom mapping type to __dict__ is a little confusing. I'd like to supply a patch, but I'm not sure what the preferred solution is. Let me explain the problem a little first. For a custom mapping type that does not inherit from dict, Python gives a nice erro

Re: [Python-Dev] python-dev Summary for 2005-02-01 through 2005-02-14 [draft]

2005-03-04 Thread Steven Bethard
Here's another two skipped threads. Ditto Tim Lesher's "comments, criticisms, or rotten tomatoes" request. =) - 2.3.5 and 2.4.1 release plans - Anthony Baxter, Alex Martelli and Tim Peters squelched a bug where deepcopy faile

Re: [Python-Dev] Documentation for __new__

2005-03-05 Thread Steven Bethard
On Sat, 5 Mar 2005 11:39:42 -0500, Greg Ward <[EMAIL PROTECTED]> wrote: > On 05 March 2005, Nick Coghlan said: > > Steven Bethard has put together some text to add __new__ to the list of > > Basic Customisation methods in the language reference. Would one of the > >

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-08 Thread Steven Bethard
Delaney, Timothy C (Timothy) <[EMAIL PROTECTED]> wrote: > The perennial "how do I remove duplicates from a list" topic came up on > c.l.py and in the discussion I mentioned the java 1.5 LinkedHashSet and > LinkedHashMap. I'd thought about proposing these before, but couldn't > think of where to put

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-09 Thread Steven Bethard
Thomas Heller <[EMAIL PROTECTED]> wrote: > [About an ordered dictionary] [snip] > I cannot understand why people are against adding it to stdlib (after > the name, the implementation, and the exact place have been decided). > It's certainly a useful data type, isn't it? Well, that was basically t

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-09 Thread Steven Bethard
Thomas Heller <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > > > What use do you have for it other than filtering > > duplicates from a list while retaining order? > > If this were the only use case, you are right. I cannot reme

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-09 Thread Steven Bethard
Delaney, Timothy C (Timothy) <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: > > > def filterdups(iterable): > > seen = set() > > for item in iterable: > > if item not in seen: > > seen.add(item) > > y

[Python-Dev] operator.methodcaller

2005-03-11 Thread Steven Bethard
On Fri, 11 Mar 2005 19:48:45 +0100, Alex Martelli <[EMAIL PROTECTED]> wrote: > Which reminds me -- could we have a methodcaller relative to attrgetter > and itemgetter? "Sort a list of strings in a case-insensitive way" > would become *SO* easy with sort(dalist, key=methodcaller('lower'))... > can

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-12 Thread Steven Bethard
Brian Sabbey <[EMAIL PROTECTED]> wrote: > (I) Give generators a __call__ method as an alternative to 'next'. > Method __call__ should take a single parameter: a function. Using > __call__ will cause the generator to start executing normally, but when a > 'yield' is reached, the generator will invo

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-12 Thread Steven Bethard
Brian Sabbey <[EMAIL PROTECTED]> wrote: > I agree that this is a confusing way to use generators. But it is the > expected way to use "code blocks" as found in other languages. It would > take some getting used to that 'for' can be used this way, but I think it > would be worth it. I guess I nee

Re: [Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-06 Thread Steven Bethard
On Apr 5, 2005 8:46 PM, Brett C. <[EMAIL PROTECTED]> wrote: > Alex A. Naanou wrote: > > Here there are two problems, the first is minor, and it is that > > anything assigned to the __dict__ attribute is checked to be a > > descendant of the dict class (mixing this in does not seem to work)... > > a

Re: [Python-Dev] anonymous blocks

2005-04-19 Thread Steven Bethard
On 4/19/05, Alex Martelli <[EMAIL PROTECTED]> wrote: > Well, one obvious use might be, say: > > @withfile('foo.bar', 'r'): > content = thefile.read() > > but that would require the decorator and block to be able to interact > in some way, so that inside the block 'thefile' is defined suitabl

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Steven Bethard
Greg Ewing wrote: > Steven Bethard wrote: > > Of course, even with the unpack list, you still have to know what kind > > of arguments the function calls your block with. And because these > > only appear within the code, e.g. > > block(openfile) > > you can&#

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Steven Bethard
Guido van Rossum wrote: > > So while: > > fooble(arg) > > is pretty nasty, documentation that tells me that 'arg' is a string is > > probably enough to set me on the right track. But if the > > documentation tells me that arg is a thunk/block, that's almost > > certainly not enough to get me g

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Steven Bethard
James Y Knight wrote: > If it was possible to assign to a variable to a variable bound outside > your function, but still in your lexical scope, I think it would fix > this issue. That's always something I've thought should be possible, > anyways. I propose to make it possible via a declaration sim

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Steven Bethard
Guido van Rossum <[EMAIL PROTECTED]> wrote: > > In case my point about the difference between thunks and other > > callables (specifically decorators) slipped by, consider the > > documentation for staticmethod, which takes a callable. All the > > staticmethod documentation says about that callabl

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Steven Bethard
On 4/21/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > It strikes me that with something like this lexical declaration, we > > could abuse decorators as per Carl Banks's recipe[1] to get the > > equivalent of thunks: > > "abuse" being the operative word. Yup. I was just drawing the parallel

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Steven Bethard
Ka-Ping Yee wrote: > It seems to me that, in general, Python likes to use keywords for > statements and operators for expressions. Probably worth noting that 'for', 'in' and 'if' in generator expressions and list comprehensions blur this distinction somewhat... Steve -- You can wordify anything

Re: [Python-Dev] Re: anonymous blocks

2005-04-24 Thread Steven Bethard
Guido van Rossum wrote: [snip illustration of how generators (and other iterators) can be modified to be used in with-blocks] > the most common use case should not be an alternate looping syntax > (even though it *is* technically a loop) but a more general "macro > statement expansion" I'm sure I

Re: [Python-Dev] Re: anonymous blocks

2005-04-24 Thread Steven Bethard
On 4/24/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 09:12 PM 4/24/05 -0600, Steven Bethard wrote: > >I guess it would be helpful to see example where the looping > >with-block is useful. > > Automatically retry an operation a set number of times before h

Re: [Python-Dev] Re: anonymous blocks

2005-04-27 Thread Steven Bethard
On 4/27/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I've written a PEP about this topic. It's PEP 340: Anonymous Block > Statements (http://python.org/peps/pep-0340.html). So block-statements would be very much like for-loops, except: (1) iter() is not called on the expression (2) the fact

Re: [Python-Dev] Re: anonymous blocks

2005-04-27 Thread Steven Bethard
Neil Schemenauer wrote: > For generators, calling __error__ with a StopIteration instance > would execute any 'finally' block. Any other argument to __error__ > would get re-raised by the generator instance. This is only one case right? Any exception (including StopIteration) passed to a generat

<    1   2   3   4   >