Mini-Pep: An Empty String ABC
Target: Py2.6 and Py3.0
Author: Raymond Hettinger
Proposal
Add a new collections ABC specified as:
class String(Sequence):
pass
Motivation
--
Having an ABC for strings allows string look-alike classes to declare
themselves as sequence
Target: Py2.6 and Py3.0
Author: Raymond Hettinger
Date: May 31, 2008
Motivation
--
The principal purpose of an abstract base class is to support multiple
implementations of an API; thereby allowing one concrete class to be
substitutable for another. This purpose is defeated when useful s
On Sat, May 31, 2008 at 10:11 PM, Alexandre Vassalotti
<[EMAIL PROTECTED]> wrote:
> Would anyone mind if I did add a public C API for gc.disable() and
> gc.enable()? I would like to use it as an optimization for the pickle
> module (I found out that I get a good 2x speedup just by disabling the
> G
Would anyone mind if I did add a public C API for gc.disable() and
gc.enable()? I would like to use it as an optimization for the pickle
module (I found out that I get a good 2x speedup just by disabling the
GC while loading large pickles). Of course, I could simply import the
gc module and call th
On Sat, May 31, 2008 at 8:09 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Raymond]
>>>
>>> I propose the following empty abstract classes: String, Datetime,
>>> Deque,
>>> and Socket.
>
> [GvR]
>>
>> Sounds like a mini-PEP is in place. It should focus on the code to
>> actually define th
[Raymond]
I propose the following empty abstract classes: String, Datetime, Deque,
and Socket.
[GvR]
Sounds like a mini-PEP is in place. It should focus on the code to
actually define these and the intended ways to use them.
Okay, will run a Google code search to see if real code exists
On Sat, May 31, 2008 at 6:41 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> From: "Guido van Rossum" <[EMAIL PROTECTED]>
>> I'm willing to meet you halfway. I really don't want isinstance(x,
>> str) to return True for something that doesn't inherit from the
>> concrete str type; this is bound t
> 2008/5/30 Farshid Lashkari <[EMAIL PROTECTED]>:
> > I'm not sure if there will be any side affects to modifying
> > sys.executable though. Should this be the official way of supporting
> > embedded interpreters or should there be a
> > multiprocessing.setExecutable() method?
>
> +1 for setExecut
From: "Guido van Rossum" <[EMAIL PROTECTED]>
I'm willing to meet you halfway. I really don't want isinstance(x,
str) to return True for something that doesn't inherit from the
concrete str type; this is bound to lead to too much confusion and
breakage.
Probably true. It was an attractive id
Raymond Hettinger wrote:
If we don't do this, then String won't be the last request. People will
want Datetime for example. Pretty much any concrete type could have a
look-a-like that wanted its own ABC and for all client code to switch
from testing concrete types.
If I remember rightly, th
Simon Cross gmail.com> writes:
> My tests show that the old-style % formatting is much faster when the
> final string is 20 characters or less:
>
> $ ./python -m timeit "'|||...%s' % '12'"
> 1000 loops, best of 3: 0.0764 usec per loop
You are the victim of a constant-folding opt
On 31/05/2008, Paul Moore <[EMAIL PROTECTED]> wrote:
> 2008/5/30 Farshid Lashkari <[EMAIL PROTECTED]>:
>> I'm not sure if there will be any side affects to modifying
>> sys.executable though. Should this be the official way of supporting
>> embedded interpreters or should there be a
>> multiprocess
I'm willing to meet you halfway. I really don't want isinstance(x,
str) to return True for something that doesn't inherit from the
concrete str type; this is bound to lead to too much confusion and
breakage. But I'm fine with a String ABC (or any other ABC, e.g.
Atomic?) that doesn't define any me
On Sat, May 31, 2008 at 11:33 AM, Georg Brandl <[EMAIL PROTECTED]> wrote:
>
> Now that the docs are reST, the source is almost pretty enough to display
> it raw, but I could also imagine a "text" writer that removes the more
> obscure markup to present a casual-reader-friendly text version.
>
> Th
Georg Brandl wrote:
Brett Cannon schrieb:
Issue 2873 - htmllib is slated to go, but pydoc still uses it. Then
again, pydoc is busted thanks to the new doc format.
I will try to handle this in the coming week.
Fred had the interesting suggestion of removing pydoc in Py3K based on
the thinki
ISTM, the whole reason people are asking for a String ABC is so you can write isinstance(obj, String) and allow registered
string-like objects to be accepted.
The downside is that everytime you want this for a concrete class or type, it is necessary to write a whole new ABC listing all of
the r
Steven D'Aprano schrieb:
but also does it provide a very cool way to get custom
sets or lists going with few extra work. Subclassing builtins was
always very painful in the past
"Always" very painful?
class ListWithClear(list):
def clear(self):
self[:] = self.__class__()
Not so
2008/5/30 Farshid Lashkari <[EMAIL PROTECTED]>:
> I'm not sure if there will be any side affects to modifying
> sys.executable though. Should this be the official way of supporting
> embedded interpreters or should there be a
> multiprocessing.setExecutable() method?
+1 for setExecutable (I'd pref
18 matches
Mail list logo