;d like to drop the possibility in P3K (assuming setdefault()
> survives).
Give a lack of legitimate use cases, do we have to wait to Py3.0? It
could likely be fixed directly and not impact any code that people care
about.
Raymond
___
Python-De
consecutive partitions:
# keep everything after the second 'X'
head, found, s = s.partition('X')
head, found, s = s.partition('x')
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyth
f those
for partition().
> BTW, I wrote a somewhat preliminary patch for this functionality
> to let you save little of your time. :-)
>
> http://people.freebsd.org/~perky/partition-r1.diff
Thanks. I've got one running already, but it is nice to have another
for comparison.
Ray
p)
s.after(sep) --> (right, sep)
s.rbefore(sep) --> (left, sep)
s.r_after(sep) --> (right, sep)
But who wants all of that?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
than an existing construct Y should be backed up by a variety of
side-by-side comparisons using real-world code samples.
I'm sure there are plenty more if these in the archives.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
ually
with just a single probe). The function may also result in more
frequent retirement of dummy entries during insertion operations.
The function can be coded from scratch or adapted from Lua's source
code.
Raymond
___
Python-Dev mailing list
en someone concocts a case where it
isn't the tool of choice. Accept it for what it is, not what it is not.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
at coding scheme itself needs to be revisited. There is
no shortage of people who have taken issue with the trailing s in
%(myvar)s.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscri
looking at the solutions used by other languages. With Py3.0,
we have a real opportunity to break-away from doing things the way C
does it.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
;, 'X',
'Y', 'Y', 'Z', 'Z']
> >>Is there a reason for this signature ?
It was handy for the use cases I had in mind when creating the function.
Also it was styled after a version in another language where it had
proven successful.
> > This is more suited to comp.lang.python
> >
> Why ? I'm not asking for help ,I'm asking why itertools library is
> implemented like that and if it is possible to clean it.
The newsgroup would have guided you to the solution listed above. If
you want to request a new feature, please use SourceForge.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
to explicitly spell 'nl=False' or "stream=fp" if that's what you
> wanted.
Good improvements.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
ht
th complicating the API.
Keep in mind the difficulties that plague str.split() -- that is what
happens when a function grows beyond a single, clear, unified, cohesive
concept.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyt
derstand that it would probably not be worth the effort
> though...
Hmm, that suggests another design principle, "If a proposer lacks faith
in his or her own proposal, it is doomed."
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
h
heir needs should be accommodated as simply and broadly as possible.
Raymond
Finance Guy
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/pytho
>Print["One", "Two", ...]
>Print["Buckle my shoe"]
The ellipsis was a nice touch.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscr
plications should be in other namespaces. That is why we don't
have str.md5(), str.crc32(), str.ziplib(), etc.
Also, I don't want to encourage dedenting as a way of life --- programs
using it often are likely to be doing things the hard way.
Raymond
sions. If you really feel the need, go ahead and add to the
docs with \versionadded{2.4.2}. My preference is to leave it be.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsu
[Neal Norwitz]
> That shows the magic number changing. You will need to read CVS logs
> to figure out why. It's possible the numbers don't really *need* to
> change.
The new LIST_APPEND opcode won't run on Py2.3.
Raymond
__
Sep 15 2005, 00:51:34) [MSC v.1200 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license()" for more information.
>>> def f():
return 2+3
>>> import dis
>>> dis.dis(f)
2 0 LOAD_CONST 3 (5)
> -Original Message-
> From: Andrew Durdin [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 16, 2005 8:25 AM
> To: [EMAIL PROTECTED]
> Cc: python-dev@python.org
> Subject: Re: [Python-Dev] C coding experiment
>
> On 9/1/05, Raymond Hettinger <[EMAIL PROTECT
he question of whether people are using them in real
code.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
has usually gotten shot down quickly, taking the former down
with it.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
13 RETURN_VALUE
Executive summary. Returning only Booleans reduces errors, makes the
code easier to review, follows other language norms, and
simplifies/speeds-up the generated code.
Raymond
P.S. Simplifying "and" and "or&qu
x27; to act like '&&' and '||' and for introducing a
conditional operator to handle everyone's favorite use cases.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
> > 2) When going back and forth between languages, it is easy to forget
> > that only Python returns something other than a boolean.
>
> As others point out, this isn't true.
In C, C++, C#, Java, and JavaScript, what do you get when you print the
result
7;t have tried to use the "x and y
or
> > z" syntax that bit him.
[Terry Reedy]
> I agree.
Me too.
> Given the later addition of generator expressions with mandatory
> parentheses , the mandatory-parentheses version of a conditional
> expression
> looks
ere partially
offset by the loss of useful information about the input to an operation
(i.e. the supplier may know and the consumer may want to know the input
size, the input type, whether the elements are unique, whether the data
is sorted, its provenance, etc.)
Raymond
__
[Guido van Rossum]
> Could you at least admit that this was an oversight and not try to
> pretend it was intentional breakage?
Absolutely. I completely missed this one.
Raymond
___
Python-Dev mailing list
Python-Dev@python.or
ple)
[Guido]
> This could have been implemented without making the
> implementation details public.
I see a way to do that by renaming the __len__ method to some private
name for internal use. This would preserve the performance gains while
still restoring
" uses would look like in real Python code as
created by a number of different authors.
It only takes about five minutes to try out a given syntax proposal on
all the fragments listed below. That short exercise provides an
excellent insight into the
#x27; else 10)
There is one that looks like it could be completely mis-interpreted:
(name + ' = ' if name else '') # as written above
((name + ' = ') if name else '') # one mental interpretation
(name + (' = ' if name
> How about this:
> Can someone update the PEP on conditional expressions to point to
> this email and update the status, etc?
Already done.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listin
ounter-example.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
> Unless I'm missing something, we would need to merge HEAD to the AST
> branch once more to pick up the changes in MAIN since the last merge,
> and then make sure everything in the AST branch is passing the test
> suite. Otherwise we risk having MAIN broken for awhile following a
> merge.
IMO, m
tax error for:
foo(a = i for i in range(10))
?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
s optimizer, so it's not
all
> that
> > crazy of an idea that Python in general will need it.
>
> Um. Well, _I_ still think it's pretty crazy.
YAGNI
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.
until the fault is found and repaired.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Phillip J. Eby]
> your observation actually means that the bug, if any, was somewhere
> else, or was inadvertently fixed or hidden by the AST branch merge.
What a nice side benefit :-)
Raymond
___
Python-Dev mailing list
Python-Dev@python.or
a bad C macro, the proposed
abstraction hides too much. We lose critical distinctions of ordered vs
unordered, mutable vs immutable, new objects vs in-place change, etc.
Without compelling use cases, the mechanism smells like a
hyper-generalization.
Raymond
___
I don't follow why the PEP deprecates catching a category of exceptions
in a different release than it deprecates raising them. Why would a
release allow catching something that cannot be raised? I must be
missing something here.
Raymond
___
P
args = e.args + ('outer context',)
raise TypeError(*args)
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
en replaced by new and better things; otherwise, we would
simply deprecate old-style classes and be done with it in Py2.5 or
Py2.6.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
** should be defined for functions so that you
> could do things like
>
>up3levels = dirname ** 3
Hmm, using the function's own namespace is an interesting idea. It
might also be a good place to put other functionals:
results = f
is really something like:
I want to write
s = s.dedent()
because it is too painful to write
s = textwrap.dedent(s)
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscri
instead of some other exception:
f = open(somefilename)
for lineno, line in enumerate(f):
. . .
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
e an else-clause for any processing
needed in the event of interruption.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archi
[Matthew F. Barnes]
> > > Perhaps it would be a useful addition to the itertools
> > > module then?
> > >
> > > itertools.interruptable(iterable)
[Raymond Hettinger]
> > Any real-world use cases or compelling contrived examples?
[Simon W
er (i.e. an array of type 'c' may either be converted
as list(arr) or arr.tostring() depending on the app)? Is the goal to
save writing explicit conversions by presuming that most iterables
aspire to be lists for transport purposes?
Raymond
_
to your earlier question as to whether
itertools.interruptable(iterable) would be a useful addition ;-)
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/ma
rt.
My preference is to leave PEP 8 for the minimum practices necessary for
one programmer to be able to read and maintain another programmer's
code.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/m
alter the direction of the discussion.
FWIW, I've been hoping for this for a long time.
In retrospect, CCing the XML list would have been nice but I don't think
it would have changed the outcome.
Raymond
___
Python-Dev mailing list
Python-
unt(start), someslice)
Raymond Hettinger
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
ogram. Right now, I cringe,
> and then I just shrug.
Doesn't collections.deque() meet your front-insertion needs?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mai
> The setentry typedef clearly violates the principles of the API, so
> it should be renamed.
In my next update, will rename it to match the Py or _Py convention.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyth
e it at the end of this message. Feel
> free to do whatever you want with it.
Feel free to send me your patch (as an attachment, not the body of an
email) and I'll take another look at it.
We discussed this a few months ago and rejected it. I'll look back to
find the reason why (p
. For sets, I made the
same design decision. It wasn't an accident. I don't plan on changing
that decision unless we find a body of real world code that would be
better-off with more frequent re-sizing.
Raymond
___
Python-Dev mailing lis
tion scheme in cases with mixed adds and pops?
Is there any new information/research beyond what has been obvious from
the moment the dict resizing scheme was born?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/ma
o
> http://svn
Those are both good references.
The code for general purpose dicts has been fine-tuned, reviewed, and
field-tested to a highly polished level. It is at a point where most
attempts to improve it will make it worse-off.
There may be some room for development in special versi
tter memory/cache utilization." A statement like this remains true
whether or not a down-sizing algorithm is present.
> Cheers,
>
> f
Hmm, your initial may be infringing on another developer's trademarked
signature ;-)
Raymond
Side note: To some degree, ignorance is bli
> And while we're at it, could you remove the "commit of" too? IMHO it
> just obscures the real content of the subject.
+1
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-d
[Guido]
> I'm not saying it's uncrashable. I'm saying that if you crash it, it's
> a bug unless proven harebrained.
+1 QOTW
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.py
the existing eval() version, it just doesn't apply
as broadly as you would have liked.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/option
d fit into a inheritance hierarchy.
On the one hand, decimals are very much like floats. On the other hand,
they can be used as integers and should not be rejected by some code
testing for baseinteger unless the value actually has a fractional part.
The latter isn't a nit in the same league
> Is it finally time in Python 2.5 to allow the "obvious" use of, say,
> str(5,2) to give '101', just the converse of the way int('101',2)
> gives 5?
+1
The only downside is that like list.reverse(), it will deprive students
of being assigned to write
[Me]
> Even if there were a performance edge, I suppose that the type
checking
> is the time critical part of most scripts.
That should be: RARELY the time critical part of most scripts.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyth
ch
for the previous use.
Another quick thought: I presume that only the str() builtin would
change and that the underlying __str__ slot would continue to be
hard-wired to the (reprfunc) signature.
Raymond
___
Python-Dev mailing list
Python-Dev@pyt
tc." applies to a very
> limited set of types, in the other case it applies to every
> conceivable type (except int).
That suggests that it would be better to simply add an int method:
x.convert_to_base(7)
Raymond
___
Python-Dev mailin
adix=10, prefix=''), as
a universal base converter that could replace bin(), hex(), oct(), etc.
That would give us fewer builtins and provide an inverse for all the
int() conversions (i.e. arbitrary bases). Also, it would allow an
unprefixed output whic
nterface checking, then it will spread like cancer. The
basenumber proposal is essentially a step down that slippery slope.
Raymond
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
l, it wouldn't be hard for someone
to build it out to support other numeric types if the need arises.
The output would have no prefixes. As Alex pointed out, it is easier
and more direct to add those after the fact if needed.
Care to pronounce on it?
z in x if (z % 2))
Accordingly,Guido rejected the braced notation for set comprehensions.
See: http://www.python.org/peps/pep-0218.html
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubs
uld you do with {'title'} -- create a four element set consisting
of letters or a single element set consisting of a string?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe
pple with arbitrary choices about whether
{1,2,3} would be a set or frozenset.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
above are sets of training
wheels
that don't come off. To misquote Einstein: The language should be as
simple
as possible, but no simpler.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
AlmostEqual(). Does that
method meet your needs or does it need to be improved in some way?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/option
-- trying to cover all the use cases is a fools errand
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
You don't have to keep writing notes to python-dev on this patch.
It is assigned to me and when I get a chance to go through it in detail,
it has a good likelihood of going in (if no issues arise).
Raymond
- Original Message -
From: "Crutcher Dunnavant" <[EMAIL PROTECT
definition is likely to be better for people who know
what they're doing; however, I still question whether it is an appropriate
remedy for the beginner issue
of why 1.1 + 1.1 + 1.1 doesn't equal 3.3.
Raymond
___
Python-Dev mailing list
on successfully generates a
decimal string representation.
The asymmetric handling of denormals by the atof() and ftoa() functions is
why you see a difference. A consequence of that asymmetry is the breakdown
of the expected eval(repr(f))==
nds of random variants?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
o the idea of having more informative iterator
representations but learned that even when it could be done, it wasn't
especially useful. When someone creates an iterator at the interactive
prompt, they almost always either wrap it in a consume
[Joao Macaiba]
> 1. For a newbie in the Python core development, what is the best PEP to
> begin with ?
I recommend, PEP 308: Conditional Expressions
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/li
[Armin Rigo]
> Hi Raymond,
. . .
> This means that _length_cue() is at the moment a special method, in the
> sense that Python can invoke it implicitely.
Okay, that makes sense. Go ahead and make the swap.
> This said, do we vote for __length_hint__ or __length_cue__? :
> Hint seems like the standard terminology in the field. I don't think
> it makes sense to invent our own terminology without some compelling
> reason.
Okay, I give, hint wins.
Raymond
___
Python-Dev mailing list
Python-Dev@p
Die thread, die!
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
ime of time pursuing this mirage, but there was no water:
http://mail.python.org/pipermail/python-dev/2004-April/044136.html
AFAICT, the only way to achieve the effect you want is to get an environment
where all iterators are designed around an API that supports being run
forward and backwa
merate(open('tmp.txt'))
IMO, switching back and forth is an especially bad idea.
Hence, enumerate's repr ought to be left alone too.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
an
exception raised at a lower level. That strategy was applied to an existing
problem for type objects and has met with good success.
IOW, there is a simpler alternative on the table, but resolution won't take
place until we collectively take interest in it again. At thi
[Barry Warsaw"]like to put email 3.1 in Python 2.5
> with the new module naming scheme. The old names will still work,
> and all the unit tests pass. Do we need a PEP for that?
+1
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python
Just do it.
- Original Message -
From: "Guido van Rossum" <[EMAIL PROTECTED]>
To: "Raymond Hettinger" <[EMAIL PROTECTED]>
Cc: "Barry Warsaw" <[EMAIL PROTECTED]>;
Sent: Friday, February 10, 2006 5:47 PM
Subject: Re: [Python-Dev] releas
- Original Message -
From: "Alex Martelli" <[EMAIL PROTECTED]>
To: "Raymond Hettinger" <[EMAIL PROTECTED]>
Cc:
Sent: Saturday, February 11, 2006 3:55 PM
Subject: PEP 351
>
> On Feb 10, 2006, at 1:05 PM, Raymond Hettinger wrote:
>
>> [
. I presume that for
frozen(x) to work a lot of types have to be modified. Python seems to fare
quite well without frozendicts and frozenlists, so do we need to introduce
them just to make the new frozen() built-in work with more than just sets?
Raymond
fall off the radar.
--
http://www.catb.org/~esr/";>Eric S. Raymond
My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.
___
Python-D
who took the responsibility to review it.
That would be *you.*
So my advice is: pull the trigger. Get forgiveness if it turns out you need
it. I don't expect you will.
--
http://www.catb.org/~esr/";>Eric S. Raymond
signature.asc
Description: PGP signature
__
Some of the older Pythonistas will remember my previous time on this
list, and possibly that I faded away quietly under time pressure from
other projects and the whole being-famous nonsense.
I'm back, for now primarily to listen. I have some questions about the
future direction of Python which I'l
1401 - 1495 of 1495 matches
Mail list logo