MP consume 2 bytes and count as one char
for purposes of len and slicing.
- Characters above the BMP consume 4 bytes and counts as
two distinct chars for purpose of len and slicing.
For wide builds, all characters are 4 bytes and count as a single
char for len and slicing.
Hope this helps,
Ra
On Nov 22, 2010, at 2:48 AM, Stephen J. Turnbull wrote:
> Raymond Hettinger writes:
>
>> Neither UTF-16 nor UCS-2 is exactly correct anyway.
>
> From a standards lawyer point of view, UCS-2 is exactly correct,
You're twisting yourself into definitional knots.
Any ex
e who take the time to
> read the standard or otherwise learn what the term means.
Bingo!
Thanks for the excellent summary of the problem.
>
> What Python does might be called USC-2+ or UCS-2e (xtended).
That would be a step in the right direction.
Raymond
___
gram
Java in Python. IMO, adding a new enumeration type
would make this situation worse. Also, it adds weight to
the language -- Python is not in needs of yet another fundamental
construct.
Raymond
P.S. I do recognize that lots of people have written their own
versions of Enum(), but I th
the __new__() takes exactly 3 arguments
> (2 given).
Can I suggest that an enum-maker be offered as a third-party module rather than
prematurely adding it into the standard library.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://
hence in a
temporarily invalid state. Avoid using get_referrers() for any purpose
other than debugging."
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org
ng beta are
illusory.
In this case, practicality beats pedantry. For the users, it is a net
win if this goes in.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org
t.
You work is appreciated and your decisions are respected.
I'm just suggesting a shift in emphasis to where the risks are.
For the users, it
is a net win if this goes in.
In the case of this feature, that's true.
It seems we're thinking a
the waters. If it's not heresy then I'd like to
>do what I can to make it happen.
>
>
Perhaps in an alternate universe ;-)
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
performance will be
disappointing.
my-two-cents,
Raymond
P.S. The dictionary approach to context objects should likely be
abandoned for the C version. If the API has to change a bit, then so be it.
___
Python-Dev mailing list
Python-Dev@python.org
http
Aahz wrote:
On Tue, Jul 18, 2006, Raymond Hettinger wrote:
P.S. The dictionary approach to context objects should likely be
abandoned for the C version. If the API has to change a bit, then so
be it.
Why do you say that? The rest I agree with; seems to me that making
Lisandro Dalcin wrote:
On 7/18/06, Tim Peters <[EMAIL PROTECTED]> wrote:
[Raymond Hettinger]
...
If the current approach gets in their way, the C implementers should feel free to
make an alternate design choice.
I expect they will, even
then use a dict subclass that overrides each of the mutating methods.
Even then, we need to drop the concept of having the flags as counters
rather than booleans.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.o
Tim Peters wrote:
...
[Raymond]
Even then, we need to drop the concept of having the flags as counters
rather than booleans.
[Georg Brandl]
Yes. Given that even Tim couldn't imagine a use case for counting the
exceptions, I think it'
ot be expected to work on other
implementations
of the standard (including a planned CPython extension module).
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.pyth
code as possible.
That would have detected the recently surfaced grammar error a little
bit earlier (the one where "for x, in listOfTuples" would not unpack).
The release process itself is going well but I don't think the pervasive
AST changes have been fully shaken
implementation decisions for
str.rpartition(). This weekend, I'll run the head on a few third-party
packages to see if their test-suites still pass -- if not, it would be
nice to have a bit of time to fix whatever arises.
Raymond
___
Python-Dev m
Greg Ewing wrote:
>As an aside, does anyone else think that it would be
>useful to have a builtin which rounds and converts to
>an int in one go? Whenever I use round(), I almost
>always want the result as an int, and making me do
>it in two steps seems unnecessarily bothersome.
>
>
I think this
r floating-point, and there are plenty of other solutions for
fixed-point.
People who care about the accuracy of calculations prefer binary,
as it is a more accurate model. That isn't a big deal, either.
Hogwash. The only issues with decimal are ease-of-use and s
w variant of
round().
Also, -10 on changing the semantics of int() to round instead of
truncate. The truncating version is found is so many other languages
and book examples, that it would be a disaster for us to choose a
different meaning.
Raymond
of suppressing exceptions.
Raymond
From: [EMAIL PROTECTED] on behalf of Guido
van RossumSent: Thu 8/24/2006 4:08 PMTo: Raymond
Hettinger; python-dev@python.org; Brian HolmesSubject: zip ->
izip; is __length_hint__ required?
At today's sprint, Brian Holmes contributed a
py().get_manager() as ctx:
ctx.prec += 2
s = ...
return +s
This is horrid. Please either revert the patch or fix it to match PEP-343.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/pyth
Raymond Hettinger wrote:
>I would like to see the changes to the decimal module reverted for the
>Py2.5 release.
>
>Currently, the code in the decimal module implements the context manager
>as a separate class instead of incorporating it directly in
>decimal.Context.
>
Phillip J. Eby wrote:
> At 05:20 PM 8/29/2006 -0700, Raymond Hettinger wrote:
>
>> * The implementation's doc string examples were not tested and don't
>> work (this is a deep error). One reads:
>>
>> with decimal.getcontext() as ctx:
>>
Nick Coghlan wrote:
> Raymond Hettinger wrote:
>
>> I would like to see the changes to the decimal module reverted for
>> the Py2.5 release.
>
>
> I believe you may be overreacting - I don't consider the current
> behaviour buggy and the module level API can
be sure to also update the docs. They currently reflect
the __context__ approach.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/pyt
Nick Coghlan wrote:
> Raymond Hettinger wrote:
>
>> The right way to do it was presented in PEP343. The implementation
>> was correct and the API was simple.
>
>
> Raymond's persuaded me that he's right on the API part at the very
> least. The current
to _ContextManager()
* make the trivial updates the whatsnew25 example
Once those nits are fixed, I recommend this patch be backported to the
Py2.5 release.
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
d
line = 'a.b.c.d'
while line:
line, sep, field = line.rpartition('.')
print field
The second fragment never terminates.
Since this is a critical API flaw rather than a implementation bug, I
think it should get fixed right away rather than waiting for
[Neal]
> Please review the patch and make a comment. I did a diff between HEAD
> and 2.4 and am fine with this going in once you are happy.
I fixed a couple of documentation nits in rev 51688.
The patch is ready-to-go.
Nick, please go ahead and backport.
R
Jim Jewett wrote:
>
>Why not just change which of the three strings holds the remainder in
>the not-found case?
>
>
That was the only change submitted.
Are you happy with what was checked-in?
Raymond
___
Python-Dev mailing
" or "rest"
terminology is more appropriate for the part of the string that may
still contain separators.
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
use the
function when making succesive partitions.
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
>
> Then shouldn't rpartition be S.rpartition(sep) -> (rest, sep, tail)
Gads, the cure is worse than the disease.
car and cdr are starting to look pretty good ;-)
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://m
lready thinking in terms of parsing from
the end of the string.
Another thought is that strings don't really have a left and right.
They have a beginning and end. The left/right or top/bottom distinction
is culture specific.
Raymond
BTW, if someone chops your ankles, does it matter which
#x27;)
'a'.rpartition('x') --> ('', '', 'a')
This was necessary so that looping/recursion would work and so that
rpartition() acts as a mirror-image of partition().
Raymond
___
Python-Dev ma
separator if found
* the unchopped remainer of the string (which may contain a separator).
Of course, if a clear example is added, the choice of words becomes much
less important.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mai
: 'www.python.org'.rpartition('.') --> ('www.python', '.',
'org')
Also, be sure to check with Neal or Anthony. Since this is just a
documentation nit, it may need to wait for Py2.5.1. Ideally, we should
only be making critical bugfixes and A
given change will help more
than it hurts. The RMs are also strongly biased against extensive
patches than haven't had a chance to go through a beta-cycle -- they
don't want their releases mucked-up.
Raymond
___
Python-
cover inputs with tree-like data structures with
data at nodes as well as the leaves (preorder, postorder, inorder
traversal, etc.)
I say use your favorite cookbook approach and leave it out of the
language.
Raymond
___
Python-Dev mailing list
served by a simple decorator, and that an expanding weakref
zoo will only making the module more difficult to learn.
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
> Also, I question the utility of maintaining a weakref to a method or
> attribute instead of holding one for the object or class.
Strike that paragraph -- the proposed weakattrs have references away from the
object, not to the object.
R
erencing
assignment was made explicit rather than hiding the weak-referencing
wrapper in a descriptor.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.o
thods bound weakly to the underlying object,
where the underlying can be deleted while the bound method persists, alive but
unusable?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
I'll mark it as withdrawn.
Raymond
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Jeremy Hylton
Sent: Wednesday, October 04, 2006 8:44 AM
To: Guido van Rossum
Cc: Hans Polak; python-dev@python.org
Subject: Re: [Python-Dev] PEP 315 - do while
On 10
No need to backport. Py_TPFLAGS_DEFAULT implies
Py_TPFLAGS_HAVE_WEAKREFS.
The change was for clarity -- most things that have the weakref slots
filled-in will also make the flag explicit -- that makes it easier on
the brain when verifying code that checks the weakref flag.
Raymond
is
> that all these flags don't really mean "I have such and such
> feature" but just "I could have such and such
> feature, if the corresponding tp_xxx field were set".
I would like to see that cleaned-up for Py3k. Ide
patches or build compatible extensions.
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, but the magnitude of the error is so large that that seems
implausible. Does anyone have a clue what is going-on?
Raymond
Python 2.4.2 (#1, Mar 29 2006, 11:22:09) [GCC 4.0.2 20051125 (Red Hat
4.0.2-8)] on linux2 Type "help", "
80.0
>>> -194 * (1/100.0)
-19400.0
>>> -194 * (1/100.0)
-19400.0
Raymond
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 19, 2006 1:44 PM
To: Raymond Hettinger
Cc: python-dev@python.org
Subject: Re: [P
actively inserting and deleting entries, can introduce
unexpected feedback between loop control and the loop body. This is a recipe
for bugs and hard-to-maintain code.
Overall, feature #1 is a non-starter and hopefully this thread will die quickly
or move off-list.
Raymond
___
do this ordering
> of co_names at compile time
It would be nice if you could avoid introducing a new invariant that would be
have to be maintained by other code generation tools or bytecode hacks.
Raymond
___
Python-Dev mailing list
P
[Michael Foord]
> Could / should 'PropertyType' be added to the types module ?
PropertyType = property
Yawn,
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsub
f the test for StopIteration
versus the test for RuntimeError. The question is whether I can swap
the test order without introducing other anomalies.
Raymond
P.S. The patch would look like this:
Index: collectionsmodule.c
===
de does not have to entail dulling the trusty old blade.
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 almost
never been of use for code updates.. It is easier and more comprehensive to
grep for
backticks or for calls to "coerce" than to run code and hope that every code
path gets
exercised.
Raymond
___
Python-Dev mailing list
Python-D
sappearing,
encoded text objects, real division and whatnot; that notion may be
a pipe-dream.
As far as "reassurance that it won't be that bad to migrate", screens full
of warnings may be less than reassuring.
Raymond
___
Python-Dev mailing li
r
(by limiting me to the intersection of the feature sets).
I think we should draw a line in the sand and resolve not to garbage-up Py2.6.
The whole Py3.0 project is about eliminating cruft and being free of the
bonds of backwards compatibility. Adding non-essential cruft to Py2.6
goes against th
ep for them.
If you don't care about 3.0 compatibilty, just don't import the module.
Outside of a compatibility module, we can decide to leave Py2.6 unmolested by
Py3.0, so I can stop being cranky.
Raymond
___
Python-Dev mailing list
P
simpler and
faster:
return PyFloat_FromDouble(floor(a/b));
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
multiple methods that can meaningfully be chained together
in an arbitrary order. It is telling that the example chooses to call
the reverse method when it could have simple chosen the reverse=True
argument to sort().
Raymond
___
Python-Dev mail
ion
> of the socket.
>
> Does anybody else think this is a good idea? (Personally I think this
> should've been done years ago. :-) Shall I check it into the head?
Yes. This is has been requested more than once, but no one ever
got around to a
[MvL]
>>>>> 1. For 2.5.1, rewrite slot_nb_inplace_power to raise an exception
>>>>> if the third argument is not None, and then invoke __ipow__ with only one
>>>>> argument.
[Raymond]
>> Why would you change Py2.5? There is no bug here.
classes).
IOW, getattr(a,n) is not always the same as a.__dict__[n].
The a.__getattribute__(n) process can be more complex than that
and a bracketed dictionary-like syntax would misleadingly mask the lookup
process.
Raymond
___
Python-Dev maili
[Raymond Hettinger]
>> Rather than munge existing syntaxes, an altogether new one would be
>> more clear:
>>
>>self->name = self.metadata->name
[Ben North]
> One thing which comes to mind about this one is that, for C/C++
> programmers, the difference bet
* Teach vars() to work with classes defining __slots__. Essentially, __slots__
are just an implementation detail designed to make instances a bit more compact.
* Make the docstring writable for staticmethods, classmethods, and properties.
We did this for function objects and it worked-out well.
> On 2/15/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>> I would like to be the one to migrate it to Py3.0.
[Steve]
> No complaints here. Not that you need my permission of course. ;-)
Thanks, I had already started working on this one.
Of course, everyone is wel
[Raymond Hettinger]
>>> * Add a pure python named_tuple class to the collections module.
>>> I've been using the class for about a year and found that it greatly
>>> improves the usability of tuples as records.
>>> http://aspn.activestate.com/ASPN/Cookboo
Of course, that specific example was solved long ago. We did not
however expose a general purpose mechanism applicable where
similar issues arise for other tuples.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/l
> Raymond Hettinger schrieb:
>> d, g, v, t, r = model(somecontract)
[MvL]
> I find that line quite unreadable
Of course, I can't give you the fully spelled-out line from proprietary code.
But at this point we're just talking about the use cases for tuples with or
without n
ision isn't central to
the proposal and is still an open question.
The __module__ idea is nice. Will add it. Likewise with pickling.
The 'show' part of __repr__ was done for speed (localized access
versus accessing the enclosing scope. Will rename it to _show
to make it clear
now to make it more clear and added a docstring.
The idea was the some use cases require that the repr exactly match
the default style for tuples and the optional argument allowed for that
possiblity with almost no performance hit.
The updated recipe is at
http://
the optional argument allowed for that
>> possiblity with almost no performance hit.
>
> But what about simply changing the __repr__?
. . .
> In [4]: Point.__repr__ = tuple.__repr__
Okay, that is the better way.
Raymond
___
Python-Dev mailing lis
real
problem. Have all major third-party extensions adopted Py_ssize_t or is some
divine force helping unconverted extensions work with converted Python code?
Maybe the datasets just haven't gotten big enough yet.
Raymond
___
Python-Dev mail
culprit. I had remembered
the PEP saying that there might be some issues for non-upgraded third-party
modules and have wondered whether others were similarly affected.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.o
ses.
Until csv and sql start returning records with field
name attributes instead of tuples, we'll need something like
we have now. Also attribute access has performance issues
compared to tuple unpacking (sad fact of life).
Raymond
___
Python-
address it. Even with a tests and docs, patch
acceptance is far from automatic. That being said, I think history has
shown that important bugs get addressed and put into bug fix releases
without much loss of time. When Py2.5.1 goes out, I expect that all
known, important
ute. If you want to rant about elitism,
bag on volunteer developers, or expound conspiracy theories about insiders and
outsiders, then your scottdial.com blog would make a better forum.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://m
[Collin Winter]>
>Could I be granted rights to the SF tracker?
Done.
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/a
d what is already provided by __builtin__.bool and __builtin__.abs.
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
sually not too much of a challenge because you're
either modifying existing text or are copying in existing markup from the
surrounding text.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-d
[Žiga Seilnacht]
>I have just accepted an invitation to become a Python
>developer, so I feel obliged to introduce myself.
Welcome aboard.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/pyth
What are the current thoughts on when Py2.5.1 will go out?
Do we need a bug-day beforehand?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman
[Raymond]
>> What are the current thoughts on when Py2.5.1 will go out?
>> Do we need a bug-day beforehand?
[AMK]
>A bug day would be a great idea! I have a mailbox bug that'd
>greatly benefit from discussion about how to fix the problem.
How about Sunda
ow you call non-slotted named methods in parent classes?
class List(list):
def append(self, x):
print x
List.append(self, x) # What is the C equivalent of this call?
Raymond
___
Python-Dev mailing list
Python-Dev@python.or
. However, changing it
makes four of the tests fail.
The question for you guys is whether or not to make the fix.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http
s the de-facto decision and becomes much harder to change.
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
because it is
really more of a suggestion or technique than an actual rule.
Also, there are plenty of other situations where the "rule" doesn't apply.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailm
I believe the failures started with Facundo Batista's checkin on April 4th:
-
Author: facundo.batista
Date: Wed Apr 4 16:10:40 2007
New Revision: 54681
Modified:
python/trunk/Lib/test/test_socket_ssl.py
Log:
Fixed the way that the .pem files are looked for
, 0) + 1
return d
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
m usually available on
AOL instant messaging with the screename: raymondewt
Likewise, consider soliciting Tim's input on how to implement the ln()
operation. That one will be tricky to get done efficiently and correctly.
Raymond
--- Begin Message ---
2007/4/10, Raymond Hettinger <[EMAIL
It looks like the release candidate has been held-up for a bit. If it is going
to stay held-up for a few days, can we unfreeze it so some bugfixes can go in
(fixing the +0/-0 problem, eliminating some segfaults, and fixing some
exception code)?
Raymond
Do any of the Iceland sprinters (Fredrik or Andrew perhaps) know why the
USE_FAST section is segregated and whether it is supposed to be on or off by
default?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman
> No, the release binaries are all produced, and just await upload.
Woohoo!
> If it's an urgent issue, we need another RC.
> If it isn't urgent (e.g. not a regression relative to 2.5.0),
> I think it should wait for 2.5.2. (IMHO all, of course)
These bug fixes will h
needed.
>
It doesn't matter. We promise to offer a full impleme
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
The pickle issue may be related to revision 53655 fixing a psuedo-bug (it was
arguable whether current or prior behavior was most desirable). Will look at
this more and will report back.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http
iness.
Am leaving this open for others to discuss and decide. The old behavior was
surprising to some, but the revised behavior also appears to have some
unforeseen consequences.
Raymond
P.S. In addition to rev 53655, a number of similar changes were ma
g up on other machines
> since the urlfetch'd files weren't being cleaned out between test
> runs.
Can you add code to clean them out between runs?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/
where cities.city like %s
and events.active = 1
and venues.address = addresses.id
and addresses.city = cities.id
and events.venue = venues.id
''',
(city,))
Raymond
___
Python-Dev maili
> Raymond> I find that style hard to maintain. What is the advantage over
> Raymond> multi-line strings?
>
>Raymond> rows = self.executesql('''
>Raymond> select cities.city, state, country
>Raymond> from cities, v
501 - 600 of 1495 matches
Mail list logo