Re: [Python-Dev] python 3 niggle: None 1 raises TypeError

2014-02-18 Thread MRAB
On 2014-02-18 13:48, Serhiy Storchaka wrote: 18.02.14 10:10, Paul Moore написав(ла): Or alternatively, a default on None function - Oracle SQL calls this nvl, so I will too: def nvl(x, dflt): return dflt if x is None else x results = sorted(invoices, key=lambda x: nvl(x.duedate,

Re: [Python-Dev] python 3 niggle: None 1 raises TypeError

2014-02-14 Thread MRAB
On 2014-02-14 08:04, Chris Withers wrote: Hi All, Sending this to python-dev as I'm wondering if this was considered when the choice to have objects of different types raise a TypeError when ordered... So, the concrete I case I have is implementing stable ordering for the python Range objects

Re: [Python-Dev] Fwd: [python-tulip] Need help to finish asyncio documentation

2014-02-08 Thread MRAB
On 2014-02-08 23:32, Guido van Rossum wrote: We could really use more help reviewing and finishing asyncio's docs! Some spelling mistakes: http://docs.python.org/dev/library/asyncio.html mimicks http://docs.python.org/dev/library/asyncio-task.html returing nummber

Re: [Python-Dev] The Argument Clinic Derby is drawing to a close

2014-01-26 Thread MRAB
On 2014-01-27 00:26, Larry Hastings wrote: On 01/26/2014 04:24 PM, Larry Hastings wrote: Patches posted to the issue tracker on or after Wednesday Jan 29 at 12:00:01am will not be accepted. Sorry, forgot to specify the time zone: PST, which is GMT -08:00. Put another way, the submission

Re: [Python-Dev] AC Derby and accepting None for optional positional arguments

2014-01-16 Thread MRAB
On 2014-01-16 05:32, Larry Hastings wrote: [snip] In the specific case of SHA1_new's string parameter, we could lie and claim that the default value is b''. Internally we could still use NULL as a default and get away with it. But this is only a happy coincidence. Many (most?) functions like

Re: [Python-Dev] PEP 460 reboot

2014-01-14 Thread MRAB
On 2014-01-14 20:54, Guido van Rossum wrote: On Tue, Jan 14, 2014 at 12:13 PM, Ethan Furman et...@stoneleaf.us wrote: On 01/14/2014 10:52 AM, Guido van Rossum wrote: Which reminds me. Quite a few people have spoken out in favor of loud failures rather than silent wrong output. But I think

Re: [Python-Dev] Binding problem

2014-01-14 Thread MRAB
On 2014-01-15 00:53, Rob Ward wrote: I apologise if I have come to the wrong place here, but 12hrs searching, plus experimenting, on the WWW for advice on it has not yielded any successful advice to resolve the issue. I am am having trouble binding an Entry widget to Return Here is the

Re: [Python-Dev] PEP 460 reboot

2014-01-13 Thread MRAB
On 2014-01-13 21:51, Guido van Rossum wrote: Terminology. Let's use the official terminology rather than making stuff up. The docs at http://docs.python.org/3/library/string.html#formatspec use the following terminology: Replacement field: {...}; contains field name, conversion, format spec in

Re: [Python-Dev] Test failures when running as root

2014-01-13 Thread MRAB
On 2014-01-14 03:03, Terry Reedy wrote: On 1/13/2014 7:48 PM, Chris Angelico wrote: And now for something completely different. My root buildbot is finally now able to telnet out and get Connection refused errors. (For the curious, the VirtualBox NAT mode doesn't work properly, but the new NAT

Re: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

2014-01-11 Thread MRAB
On 2014-01-11 05:36, Steven D'Aprano wrote: [snip] Latin-1 has the nice property that every byte decodes into the character with the same code point, and visa versa. So: for i in range(256): assert bytes([i]).decode('latin-1') == chr(i) assert chr(i).encode('latin-1') == bytes([i])

Re: [Python-Dev] Python3 complexity

2014-01-08 Thread MRAB
On 2014-01-09 00:07, Ben Finney wrote: Kristján Valur Jónsson krist...@ccpgames.com writes: Believe it or not, sometimes you really don't care about encodings. Sometimes you just want to parse text files. Files don't contain text, they contain bytes. Bytes only become text when filtered

Re: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

2014-01-08 Thread MRAB
On 2014-01-06 13:24, Victor Stinner wrote: Hi, bytes % args and bytes.format(args) are requested by Mercurial and Twisted projects. The issue #3982 was stuck because nobody proposed a complete definition of the new features. Here is a try as a PEP. The PEP is a draft with open questions.

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread MRAB
On 05/12/2013 19:22, Ethan Furman wrote: On 12/05/2013 10:56 AM, Alexander Belopolsky wrote: On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum wrote: How would you get the docstrings in? [...] One way to reduce the amount of boilerplate code is to make abstractmethod to supply raise

Re: [Python-Dev] PEP 0404 and VS 2010

2013-11-20 Thread MRAB
On 20/11/2013 23:36, Christian Tismer wrote: Hey Barry, On 20.11.13 23:30, Barry Warsaw wrote: On Nov 20, 2013, at 09:52 PM, Christian Tismer wrote: Many customers are forced to stick with Python 2.X because of other products, but they require a Python 2.X version which can be compiled using

[Python-Dev] Compiler security

2013-10-31 Thread MRAB
Has anybody here heard about this, and, if so, is it anything we should be thinking about: How your compiler may be compromising application security http://www.itworld.com/security/380406/how-your-compiler-may-be-compromising-application-security ___

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-24 Thread MRAB
On 24/10/2013 15:40, Kristján Valur Jónsson wrote: -Original Message- From: Nick Coghlan [mailto:ncogh...@gmail.com] Sent: 24. október 2013 12:44 To: Kristján Valur Jónsson Cc: Python Dev Subject: Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics! Not everything is a PC

Re: [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

2013-10-12 Thread MRAB
On 12/10/2013 05:05, Ethan Furman wrote: On 10/11/2013 07:47 PM, Stephen J. Turnbull wrote: Nick Coghlan writes: (RDM is also right that the exception still has the effect of terminating the block early, but I view names as mnemonics rather than necessarily 100% accurate descriptions

Re: [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

2013-10-11 Thread MRAB
On 11/10/2013 18:39, Ethan Furman wrote: On 10/11/2013 09:43 AM, Barry Warsaw wrote: On Oct 11, 2013, at 06:27 PM, Georg Brandl wrote: Maybe to fit in with other verb-like APIs used as context managers: it's open() not opened(). open() predates context managers, but maybe we need a new

Re: [Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

2013-10-11 Thread MRAB
On 11/10/2013 19:41, Glenn Linderman wrote: On 10/11/2013 10:19 AM, Eric V. Smith wrote: On 10/11/2013 12:43 PM, Barry Warsaw wrote: On Oct 11, 2013, at 06:27 PM, Georg Brandl wrote: Maybe to fit in with other verb-like APIs used as context managers: it's open() not opened(). open()

Re: [Python-Dev] PEP 455: TransformDict

2013-10-08 Thread MRAB
On 08/10/2013 19:02, Yuriy Taraday wrote: On Fri, Sep 13, 2013 at 10:40 PM, Antoine Pitrou solip...@pitrou.net mailto:solip...@pitrou.net wrote: Hello, Following the python-dev discussion, I've written a PEP to recap the proposal and the various arguments. It's inlined below, and

Re: [Python-Dev] On the dangers of giving developers the best resources

2013-10-08 Thread MRAB
On 08/10/2013 23:21, Tim Delaney wrote: On 9 October 2013 09:10, Guido van Rossum gu...@python.org mailto:gu...@python.org wrote: It's not actually so much the extreme waste that I'm looking to expose, but rather the day-to-day annoyances of stuff you use regularly that slows you

Re: [Python-Dev] toolbar

2013-09-28 Thread MRAB
On 28/09/2013 12:28, Kevin Ngugi wrote: Hi, I just downloaded Python 3.3 top teach myself how to program, I am new to programming, but the guide I am using requires me to access the toolbar, which I cannot seem to find. How do I find it and have it displayed on the interface? I tried v 3.1 but

Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013-09-25 Thread MRAB
| method ignored? It explains fairly clearly what has | happened, and also indicates what do do about it -- | catch it in the __del__ method. | | Exception in __del__ caught and not propagated: | Georg On 24Sep2013 09:33, Glenn Linderman v+pyt...@g.nevcal.com wrote: | [MRAB]: | Why not just

Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013-09-24 Thread MRAB
On 24/09/2013 09:06, Nick Coghlan wrote: On 24 September 2013 17:34, Antoine Pitrou solip...@pitrou.net wrote: On Tue, 24 Sep 2013 17:25:10 +1000 Nick Coghlan ncogh...@gmail.com wrote: You are setting the bar unreasonably high for an error message that has to convey a complex concept in as

Re: [Python-Dev] Best practice for documentation for std lib

2013-09-23 Thread MRAB
On 23/09/2013 20:01, Terry Reedy wrote: On 9/22/2013 10:44 PM, Guido van Rossum wrote: Glad you like it. I still do, too, but I've given up hope to convince all core developers to stick to this style. :-( [me] ('Return' rather than 'Returns' is the current convention.) That's actually a

Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013-09-23 Thread MRAB
On 23/09/2013 22:19, Nick Coghlan wrote: On 24 Sep 2013 01:24, Antoine Pitrou solip...@pitrou.net mailto:solip...@pitrou.net wrote: On Mon, 23 Sep 2013 18:51:04 +1000 Nick Coghlan ncogh...@gmail.com mailto:ncogh...@gmail.com wrote: On 23 September 2013 18:45, Antoine Pitrou

Re: [Python-Dev] PEP 455: TransformDict

2013-09-14 Thread MRAB
On 14/09/2013 05:47, Ethan Furman wrote: On 09/13/2013 08:18 PM, Steven D'Aprano wrote: You're missing that I'm not iterating over the entire dict, just some subset (data) that I got from elsewhere. Ah, okay. Between you and Antoine I am convinced that .getitem() is a good thing. So have

Re: [Python-Dev] PEP 455: TransformDict

2013-09-13 Thread MRAB
On 14/09/2013 01:49, Steven D'Aprano wrote: On Fri, Sep 13, 2013 at 11:45:16PM +0200, Antoine Pitrou wrote: Ok, I have a better (IMO) proposal: d = TransformDict(str.casefold, {'Foo': 1}) d.getitem('foo') ('Foo', 1) d.getitem('bar') Traceback (most recent call last):

Re: [Python-Dev] PEP 455: TransformDict

2013-09-13 Thread MRAB
On 14/09/2013 02:40, Ethan Furman wrote: On 09/13/2013 06:25 PM, MRAB wrote: On 14/09/2013 01:49, Steven D'Aprano wrote: Is it more common to want both the canonical key and value at the same time, or to just want the canonical key? My gut feeling is that I'm likely to have code like

Re: [Python-Dev] Add a transformdict to collections

2013-09-10 Thread MRAB
On 10/09/2013 20:08, Paul Moore wrote: On 10 September 2013 19:31, Antoine Pitrou solip...@pitrou.net wrote: I think it would be a flaw to have this detail implementation-defined. This would be like saying that it is implementation-defined which of A,B,C is returned from A and B and C if all

Re: [Python-Dev] Add a transformdict to collections

2013-09-10 Thread MRAB
On 10/09/2013 22:46, Antoine Pitrou wrote: On Tue, 10 Sep 2013 18:44:20 -0300 Joao S. O. Bueno jsbu...@python.org.br wrote: On 10 September 2013 18:06, Antoine Pitrou solip...@pitrou.net wrote: On Tue, 10 Sep 2013 17:38:26 -0300 Joao S. O. Bueno jsbu...@python.org.br wrote: On 10 September

Re: [Python-Dev] unicodedata module is out of date

2013-09-06 Thread MRAB
On 06/09/2013 10:54, Andrew Miller wrote: The unicodedata module only contains data up to Unicode 5.2 (October 2009), so attempting to reference any character from a later version e.g: unicodedata.lookup(TURKISH LIRA SIGN) results in a KeyError. Also, it seems to be limited to properties in

Re: [Python-Dev] Accepted: PEP 446 -- Make newly created file descriptors non-inheritable

2013-08-28 Thread MRAB
On 28/08/2013 07:29, Paul Moore wrote: On 27 August 2013 23:17, Guido van Rossum gu...@python.org mailto:gu...@python.org wrote: Thanks for your tiresome work I'm guessing you meant tireless here :-) That depends. It might have been tiresome for the one doing it!

Re: [Python-Dev] When to remove deprecated stuff

2013-08-15 Thread MRAB
On 15/08/2013 13:29, R. David Murray wrote: On Thu, 15 Aug 2013 11:22:14 +0200, Antoine Pitrou solip...@pitrou.net wrote: On Thu, 15 Aug 2013 11:16:20 +0200 Victor Stinner victor.stin...@gmail.com wrote: 2013/8/15 Antoine Pitrou solip...@pitrou.net: We don't have any substantial change in

Re: [Python-Dev] Deprecating the formatter module

2013-08-14 Thread MRAB
On 14/08/2013 17:17, Eli Bendersky wrote: On Wed, Aug 14, 2013 at 9:09 AM, Nick Coghlan ncogh...@gmail.com mailto:ncogh...@gmail.com wrote: On 14 August 2013 11:55, Brett Cannon br...@python.org mailto:br...@python.org wrote: On Wed, Aug 14, 2013 at 11:47 AM, Nick Coghlan

Re: [Python-Dev] Misc re.match() complaint

2013-07-17 Thread MRAB
On 17/07/2013 05:15, Stephen J. Turnbull wrote: Terry Reedy writes: On 7/15/2013 10:20 PM, Guido van Rossum wrote: Or is this something deeper, that a group *is* a new object in principle? No, I just think of it as returning a string That is exactly what the doc says

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread MRAB
On 16/07/2013 00:30, Gregory P. Smith wrote: On Mon, Jul 15, 2013 at 4:14 PM, Guido van Rossum gu...@python.org mailto:gu...@python.org wrote: In a discussion about mypy I discovered that the Python 3 version of the re module's Match object behaves subtly different from the Python

Re: [Python-Dev] Misc re.match() complaint

2013-07-15 Thread MRAB
On 16/07/2013 01:25, Guido van Rossum wrote: On Mon, Jul 15, 2013 at 5:10 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 16/07/2013 00:30, Gregory P. Smith wrote: On Mon, Jul 15, 2013 at 4:14 PM, Guido van Rossum gu...@python.org mailto:gu...@python.org wrote: In a discussion about mypy

Re: [Python-Dev] Unicode minus sign in numeric conversions

2013-06-08 Thread MRAB
On 08/06/2013 23:30, Guido van Rossum wrote: [Diverting to python-ideas, since this isn't as clear-cut as you think.] Why exactly is that expected behavior? What's the use case? (Surely you don't have a keyboard that generates \u2212 when you hit the minus key? :-) Is there a Unicode standard

[Python-Dev] PyPI upload error

2013-06-04 Thread MRAB
I've just tried to upload to PyPI using setup.py and got this error: Upload failed (503): backend write error Can anyone tell me what it means? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] PyPI upload error

2013-06-04 Thread MRAB
On 05/06/2013 03:07, Donald Stufft wrote: On Jun 4, 2013, at 9:47 PM, MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com wrote: I've just tried to upload to PyPI using setup.py and got this error: Upload failed (503): backend write error Can anyone tell me what it means

Re: [Python-Dev] cpython (merge 3.3 - default): Merge with 3.3

2013-05-28 Thread MRAB
On 29/05/2013 00:29, Terry Jan Reedy wrote: On 5/28/2013 3:39 PM, Antoine Pitrou wrote: On Tue, 28 May 2013 15:06:39 -0400 Terry Reedy tjre...@udel.edu wrote: Yes, Nick suggested README instead of what I had. I want a prefix to keep it near the top of a directory listing even when other non

Re: [Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info

2013-05-10 Thread MRAB
On 10/05/2013 11:55, Ben Hoyt wrote: A few of us were having a discussion at http://bugs.python.org/issue11406 about adding os.scandir(): a generator version of os.listdir() to make iterating over very large directories more memory efficient. This also reflects how the OS gives things to you --

Re: [Python-Dev] Difference in RE between 3.2 and 3.3 (or Aaron Swartz memorial)

2013-05-05 Thread MRAB
On 05/05/2013 23:01, Matej Cepl wrote: - Original Message - From: Armin Rigo ar...@tunes.org To: Matej Cepl mc...@redhat.com Cc: python-dev@python.org Sent: Saturday, May 4, 2013 11:59:42 AM Subject: Re: [Python-Dev] Difference in RE between 3.2 and 3.3 (or Aaron Swartz memorial) Hi

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread MRAB
On 29/04/2013 19:24, Steven D'Aprano wrote: On 30/04/13 03:01, Guido van Rossum wrote: Oh dear, this is actually a mess. I don't want MoreColor.red and Color.red to be distinct objects, but then the isinstance() checks will become confusing. If we don't override isinstance(), we'll get not

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread MRAB
On 29/04/2013 21:00, Steven D'Aprano wrote: On 30/04/13 05:02, MRAB wrote: Why is that backwards? MoreColor is a subclass of Color, so instances of MoreColor are instances of Color, but instances of Color are not instances of MoreColor. That's normal behaviour for subclasses. (All cats

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-26 Thread MRAB
On 26/04/2013 06:21, Ethan Furman wrote: On 04/25/2013 08:14 PM, Greg wrote: On 26/04/2013 1:28 p.m., Ethan Furman wrote: Interesting idea, but why does Day(3) have to be disallowed to make it work? Because it's ambiguous. Which day of the week is number 3? It depends on where you start.

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-25 Thread MRAB
On 25/04/2013 14:34, Lennart Regebro wrote: On Thu, Apr 25, 2013 at 2:57 PM, Antoine Pitrou solip...@pitrou.net wrote: I can think of many usecases where I want to *embed* base64-encoded data in a larger text *before* encoding that text and transmitting it over a 8-bit channel. That still

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-25 Thread MRAB
On 25/04/2013 15:22, MRAB wrote: On 25/04/2013 14:34, Lennart Regebro wrote: On Thu, Apr 25, 2013 at 2:57 PM, Antoine Pitrou solip...@pitrou.net wrote: I can think of many usecases where I want to *embed* base64-encoded data in a larger text *before* encoding that text and transmitting it over

Re: [Python-Dev] NoneType(None) raises exception

2013-04-25 Thread MRAB
On 26/04/2013 00:09, Ethan Furman wrote: We just fixed NoneType() to return None instead of raising an exception. Another use-case for calling NoneType is working with ORMs: result = [] for field in row: type = get_type(field) # returns int, bool, str, NoneType, ...

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread MRAB
On 26/04/2013 00:59, Glenn Linderman wrote: On 4/25/2013 3:23 PM, Barry Warsaw wrote: My point is, days of the week has a natural ordering, so why wouldn't you use IntEnum for that? Problem solved. While the ordering is natural, some implementations start from 0, some start from 1, and on

Re: [Python-Dev] NoneType(None) raises exception

2013-04-25 Thread MRAB
On 26/04/2013 01:27, Steven D'Aprano wrote: On 26/04/13 09:56, MRAB wrote: On the one hand, NoneType(None) seems a strange thing to do. Only when you write it out like that as constants. It's no more, or less, strange than str('spam') or int(1) or list([]). Why would you do that? None

Re: [Python-Dev] Difference in RE between 3.2 and 3.3 (or Aaron Swartz memorial)

2013-03-06 Thread MRAB
On 2013-03-06 14:18, Amaury Forgeot d'Arc wrote: Hi, 2013/3/6 Matěj Cepl mc...@redhat.com mailto:mc...@redhat.com On 2013-02-26, 16:25 GMT, Terry Reedy wrote: On 2/21/2013 4:22 PM, Matej Cepl wrote: as my method to commemorate Aaron Swartz, I have decided to port his

Re: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

2013-02-25 Thread MRAB
On 2013-02-25 16:37, Barry Warsaw wrote: On Feb 25, 2013, at 07:12 AM, Ethan Furman wrote: And if, in those places, the enums were based on ints (or strings), would it hurt you? Because in the places where I, as well as many others, use enums we *need* the int portion; and having to wrap the

[Python-Dev] Can't upload to PyPI

2013-02-21 Thread MRAB
Since the PyPI security notice of 2013-02-15 I've been unable to upload to PyPI via setup.py upload. I changed my password during the grace period, and have reset it, but it's still rejected: Upload failed (401): Incorrect password I can login to PyPI with the password. Can anyone suggest

Re: [Python-Dev] Can't upload to PyPI

2013-02-21 Thread MRAB
On 2013-02-22 02:09, Ian Cordasco wrote: On Thu, Feb 21, 2013 at 9:02 PM, MRAB pyt...@mrabarnett.plus.com wrote: Since the PyPI security notice of 2013-02-15 I've been unable to upload to PyPI via setup.py upload. I changed my password during the grace period, and have reset it, but it's still

Re: [Python-Dev] Can't upload to PyPI

2013-02-21 Thread MRAB
On 2013-02-22 02:37, Ian Cordasco wrote: On Thu, Feb 21, 2013 at 9:27 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2013-02-22 02:09, Ian Cordasco wrote: On Thu, Feb 21, 2013 at 9:02 PM, MRAB pyt...@mrabarnett.plus.com wrote: Since the PyPI security notice of 2013-02-15 I've been unable

Re: [Python-Dev] Usage of += on strings in loops in stdlib

2013-02-13 Thread MRAB
On 2013-02-13 13:23, Lennart Regebro wrote: On Wed, Feb 13, 2013 at 1:10 PM, Serhiy Storchaka storch...@gmail.com wrote: I prefer x = '%s%s%s%s' % (a, b, c, d) when string's number is more than 3 and some of them are literal strings. This has the benefit of being slow both on CPython and

Re: [Python-Dev] Usage of += on strings in loops in stdlib

2013-02-12 Thread MRAB
On 2013-02-12 21:44, Antoine Pitrou wrote: On Tue, 12 Feb 2013 16:40:38 -0500 Ned Batchelder n...@nedbatchelder.com wrote: But the only reason .join() is a Python idiom in the first place is because it was the fast way to do what everyone initially coded as s += Just because we all

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-12 Thread MRAB
On 2012-12-12 23:33, Lennart Regebro wrote: On Thu, Dec 13, 2012 at 12:23 AM, Terry Reedy tjre...@udel.edu wrote: As a Windows user, I would like there to be one tz data file used by all Python versions on my machine, including ones included with other apps. That would be nice, but where

Re: [Python-Dev] Do more at compile time; less at runtime

2012-12-09 Thread MRAB
On 2012-12-09 22:22, Mark Shannon wrote: Hi all, The current CPython bytecode interpreter is rather more complex than it needs to be. A number of bytecodes could be eliminated and a few more simplified by moving the work involved in handling compound statements (loops, try-blocks, etc) from the

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-09 Thread MRAB
On 2012-12-10 01:44, Raymond Hettinger wrote: The current memory layout for dictionaries is unnecessarily inefficient. It has a sparse table of 24-byte entries containing the hash value, key pointer, and value pointer. Instead, the 24-byte entries should be stored in a dense table referenced

Re: [Python-Dev] Keyword meanings [was: Accept just PEP-0426]

2012-12-08 Thread MRAB
On 2012-12-08 20:18, PJ Eby wrote: On Sat, Dec 8, 2012 at 5:06 AM, Nick Coghlan ncogh...@gmail.com wrote: On Sat, Dec 8, 2012 at 4:46 PM, PJ Eby p...@telecommunity.com wrote: So if package A includes a Conflicts: B declaration, I recommend the following: * An attempt to install A with B

Re: [Python-Dev] Conflicts [was Re: Keyword meanings [was: Accept just PEP-0426]]

2012-12-08 Thread MRAB
On 2012-12-09 01:15, Steven D'Aprano wrote: On 09/12/12 08:14, MRAB wrote: If package A says that it conflicts with package B, it may or may not be symmetrical, because it's possible that package B has been updated since the author of package A discovered the conflict, so it's important

Re: [Python-Dev] Keyword meanings [was: Accept just PEP-0426]

2012-12-05 Thread MRAB
On 2012-12-06 02:12, Stephen J. Turnbull wrote: I understand the PEP author's frustration with continued discussion, but I think this subthread on Obsoletes vs. Obsoleted-By is not mere bikeshedding on names. It matters *which package* presents the information. Donald Stufft writes: On

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread MRAB
On 2012-11-14 20:53, Mark Adam wrote: On Wed, Nov 14, 2012 at 1:37 PM, Xavier Morel catch-...@masklinn.net wrote: On 2012-11-14, at 19:54 , Mark Adam wrote: Merging of two dicts is done with dict.update. No, dict.update merges one dict (or two) into a third one. No. I think you need to

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread MRAB
On 2012-11-14 21:20, MRAB wrote: On 2012-11-14 20:53, Mark Adam wrote: On Wed, Nov 14, 2012 at 1:37 PM, Xavier Morel catch-...@masklinn.net wrote: On 2012-11-14, at 19:54 , Mark Adam wrote: Merging of two dicts is done with dict.update. No, dict.update merges one dict (or two) into a third

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread MRAB
On 2012-11-14 21:40, Greg Ewing wrote: Chris Angelico wrote: Perhaps an alternative question: What can be done to make the latter less unpalatable? * We could introduce a new syntax such as {a = 1, b = 2}. * If the compiler were allowed to recognise builtins, it could turn dict(a = 1, b = 2)

Re: [Python-Dev] chained assignment weirdity

2012-11-06 Thread MRAB
On 2012-11-06 15:02, Rob Cliffe wrote: On 06/11/2012 12:01, Nick Coghlan wrote: As noted, it's really only counterintuitive if your intuition is primed to expect C style right to left chained assignments. Python, on the other hand, is able to preserve primarily left to right evaluation in

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-18 Thread MRAB
On 2012-10-19 02:03, Victor Stinner wrote: Hi, I would like to know if there a reason for not using the hash of (bytes or unicode) strings when comparing two objects and the hash of the two objects was already been computed. Using the hash would speed up comparaison of long strings when the two

Re: [Python-Dev] [Python-checkins] cpython (merge 3.3 - default): Merge issue #15936: Add link from os.urandom to random.SystemRandom

2012-10-16 Thread MRAB
On 2012-10-16 12:59, Stephen J. Turnbull wrote: Antoine Pitrou writes: But, yes, I would call it higher level rather than easy to use (I don't think there's a need for hyphens, by the way). You don't need them to get the point across, but elderly grammar pedants will think better of you

Re: [Python-Dev] Proposed schedule for Python 3.4

2012-10-03 Thread MRAB
On 2012-10-03 16:28, Brian Curtin wrote: On Wed, Oct 3, 2012 at 10:13 AM, Larry Hastings la...@hastings.org wrote: On 10/03/2012 04:55 PM, Nick Coghlan wrote: Regardless of when the first alpha happens, I'll be promoting the hell out of it, begging for feedback on any of these changes that are

Re: [Python-Dev] Stdlib and timezones, again

2012-09-30 Thread MRAB
On 2012-09-30 19:55, Serhiy Storchaka wrote: On 30.09.12 16:15, Antoine Pitrou wrote: Probably, but for most purposes I would guess a 2-year old database is still good enough? After all, you don't see many people complaining about the outdated Unicode database that is hard-wired in past

Re: [Python-Dev] Decimal(2) != float(2)???

2012-09-29 Thread MRAB
On 2012-09-30 01:43, Jan Kaliszewski wrote: Hello, In http://docs.python.org/release/3.2.3/reference/expressions.html#in we read: [...] This can create the illusion of non-transitivity between supported cross-type comparisons and unsupported comparisons. For example, Decimal(2) == 2 and 2 ==

Re: [Python-Dev] Release of astoptimizer 0.3

2012-09-11 Thread MRAB
On 11/09/2012 13:06, Victor Stinner wrote: * Call builtin functions if arguments are constants. Examples: - len(abc) = 3 - ord(A) = 65 Does it preserve python semantics? What if you change the len builtin? This optimization is disabled by default (in the version 0.3), because builtin

Re: [Python-Dev] Release of astoptimizer 0.3

2012-09-11 Thread MRAB
On 11/09/2012 22:46, Victor Stinner wrote: 2012/9/11 Nick Coghlan ncogh...@gmail.com: This is fine in an external project, but should never be added to the standard library. The barrier to semantic changes that break monkeypatching should be high. The version 0.3 has a known bug: len=chr;

Re: [Python-Dev] why is _PyBytes_Join not public but PyUnicode_Join is?

2012-08-30 Thread MRAB
On 31/08/2012 02:43, Gregory P. Smith wrote: We have use for _PyBytes_Join in an extension module but technically it isn't a public Python C API... anyone know why? PyUnicode_Join is. Looking up the bytes 'join' method and using the C API to call that method object with proper parameters seems

Re: [Python-Dev] Should urlencode() sort the query parameters (if they come from a dict)?

2012-08-18 Thread MRAB
On 18/08/2012 18:34, Guido van Rossum wrote: On Sat, Aug 18, 2012 at 6:28 AM, Christian Heimes li...@cheimes.de wrote: Am 17.08.2012 21:27, schrieb Guido van Rossum: I wonder if it wouldn't make sense to change urlencode() to generate URLs that don't depend on the hash order, for all versions

Re: [Python-Dev] python 2.7 + https + urlopen = ?

2012-08-12 Thread MRAB
On 13/08/2012 02:39, Python Urlopen wrote: [snip] After a lot of pain, I got myself out of this trouble, and my code now works correctly on 2.7.x (thanks to Jean-Paul Calderone's pyopenssl). But do you think this is a feature and not a bug? -- And do you think debating on this, killing time

Re: [Python-Dev] No summary of tracker issues this week?

2012-08-05 Thread MRAB
On 05/08/2012 23:31, Mark Lawrence wrote: Hi all, I keep an eye open for this but can't find one for Saturday 03/08/2012. Have I missed it, has it been stopped, has something gone wrong with its production or what? I haven't seen it either. ___

Re: [Python-Dev] Question

2012-08-03 Thread MRAB
On 03/08/2012 19:53, Dheeraj Goswami wrote: Hi Python Gurus, I am an experienced Java developer and have been working on it for about 8 years. I need to build a web 2.0/AJAX based website/application and I am thinking to build it in Django which means I need to learn and move to Python. Please

Re: [Python-Dev] issue 15510: textwrap.wrap() returning empty list

2012-08-03 Thread MRAB
On 03/08/2012 21:46, Chris Jerdonek wrote: I would like people's opinions on issue 15510, specifically whether it should be addressed and in what versions: http://bugs.python.org/issue15510 Jesús suggested that I ask. The issue relates to textwrap.wrap()'s behavior when wrapping strings that

Re: [Python-Dev] 2.7 releases

2012-07-27 Thread MRAB
On 27/07/2012 20:12, Benjamin Peterson wrote: 2012/7/26 Thomas Heller thel...@ctypes.org: Will there be more 2.7 bugfix releases, and when the next one? Probably late fall or early 2013. Or, for those in the southern hemisphere, late spring or early 2013.

Re: [Python-Dev] [Python-checkins] cpython: Issue #14769: test_capi now has SkipitemTest, which cleverly checks

2012-06-22 Thread MRAB
On 22/06/2012 17:39, Terry Reedy wrote: On 6/22/2012 6:57 AM, larry.hastings wrote: http://hg.python.org/cpython/rev/ace45d23628a changeset: 77567:ace45d23628a user:Larry Hastings la...@hastings.org date:Fri Jun 22 03:56:29 2012 -0700 summary: Issue #14769: test_capi now

Re: [Python-Dev] [Python-checkins] cpython: Issue #14769: test_capi now has SkipitemTest, which cleverly checks

2012-06-22 Thread MRAB
On 22/06/2012 21:45, Larry Hastings wrote: On 06/22/2012 01:29 PM, Terry Reedy wrote: Of course. And character 32 space is also not usable and perhaps not worth testing. Au contraire! I grant you, it's hard to imagine how using it would be a good idea. But strictly speaking it is *usable*.

Re: [Python-Dev] Raw string syntax inconsistency

2012-06-17 Thread MRAB
On 18/06/2012 00:55, Nick Coghlan wrote: On Mon, Jun 18, 2012 at 6:41 AM, Guido van Rossumgu...@python.org wrote: Would it make sense to detect and reject these in 3.3 if the 2.7 syntax is used? Possibly - I'm trying not to actually *change* any of the internals of the string literal

[Python-Dev] PyPI down?

2012-06-14 Thread MRAB
It looks like PyPI is down. :-( ___ 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

Re: [Python-Dev] cpython (2.7): Issue #15060: fix typo in socket doc; Patch by anatoly techtonik

2012-06-14 Thread MRAB
On 14/06/2012 15:15, Georg Brandl wrote: Am 13.06.2012 23:59, schrieb sandro.tosi: http://hg.python.org/cpython/rev/744fb52ffdf0 changeset: 77417:744fb52ffdf0 branch: 2.7 parent: 77408:60a7b704de5c user:Sandro Tosisandro.t...@gmail.com date:Wed Jun 13 23:58:35

Re: [Python-Dev] what is happening with the regex module going into Python 3.3?

2012-06-05 Thread MRAB
On 05/06/2012 03:40, Terry Reedy wrote: On 6/4/2012 9:22 PM, MRAB wrote: I'm not planning any further changes to regex. I think it already has enough features... Do you have any idea where regex + Python stands in regard to Unicode TR18 support levels? http://unicode.org/reports/tr18

Re: [Python-Dev] TZ-aware local time

2012-06-05 Thread MRAB
On 06/06/2012 02:57, Alexander Belopolsky wrote: On Tue, Jun 5, 2012 at 7:11 PM, Greg Ewinggreg.ew...@canterbury.ac.nz wrote: What would be so bad about giving datetime objects a DST flag? Apps that don't care could ignore it and get results no worse than the status quo. This would neatly

Re: [Python-Dev] what is happening with the regex module going into Python 3.3?

2012-06-04 Thread MRAB
(I've been having trouble with my email recently, so I missed this thread amongst others.) I personally am no longer that bothered about whether the regex module makes it into stdlib, but I am still be maintaining it on PyPI. If someone else wants to integrate it I would, of course, be willing

Re: [Python-Dev] what is happening with the regex module going into Python 3.3?

2012-06-04 Thread MRAB
On 05/06/2012 01:31, Steven D'Aprano wrote: MRAB wrote: I personally am no longer that bothered about whether the regex module makes it into stdlib, but I am still be maintaining it on PyPI. If someone else wants to integrate it I would, of course, be willing to help out. Are you

[Python-Dev] Omission in re.sub?

2011-12-11 Thread MRAB
I've just come across an omission in re.sub which I hadn't noticed before. In re.sub the replacement string can contain escape sequences, for example: repr(re.sub(rx, r\n, axb)) 'a\\nb' However: repr(re.sub(rx, r\x0A, axb)) 'ax0Ab' Yes, it doesn't recognise \xNN. Is there a reason for

Re: [Python-Dev] Omission in re.sub?

2011-12-11 Thread MRAB
On 11/12/2011 20:27, Guido van Rossum wrote: On Sun, Dec 11, 2011 at 12:12 PM, MRABpyt...@mrabarnett.plus.com wrote: I've just come across an omission in re.sub which I hadn't noticed before. In re.sub the replacement string can contain escape sequences, for example: repr(re.sub(rx, r\n,

Re: [Python-Dev] Omission in re.sub?

2011-12-11 Thread MRAB
On 11/12/2011 21:04, Guido van Rossum wrote: On Sun, Dec 11, 2011 at 12:47 PM, MRABpyt...@mrabarnett.plus.com wrote: On 11/12/2011 20:27, Guido van Rossum wrote: On Sun, Dec 11, 2011 at 12:12 PM, MRABpyt...@mrabarnett.plus.com wrote: I've just come across an omission in re.sub which I

Re: [Python-Dev] Should we move to replace re with regex?

2011-08-26 Thread MRAB
On 27/08/2011 00:08, Tom Christiansen wrote: M.-A. Lemburgm...@egenix.com wrote on Sat, 27 Aug 2011 01:00:31 +0200: The good part is that it's based on the re code, the FUD comes from the fact that the new lib is 380kB larger than the old one and that's not even counting the generated

[Python-Dev] urllib bug in Python 3.2.1?

2011-07-31 Thread MRAB
Someone over at StackOverflow has a problem with urlopen in Python 3.2.1: http://stackoverflow.com/questions/6892573/problem-with-urlopen/6892843#6892843 This is the code: from urllib.request import urlopen f =

[Python-Dev] Adding function checks to regex

2011-03-18 Thread MRAB
Some of those who are relative new to regexes sometimes ask how to write a regex which checks that a number is in a range or is a valid date. Although this may be possible, it certainly isn't easy. From what I've read, Perl has a way of including code in a regex, but I don't think that's a

Re: [Python-Dev] Strange occasional marshal error

2011-03-03 Thread MRAB
On 03/03/2011 15:09, Graham Stratton wrote: On Mar 2, 3:01 pm, Graham Strattongrahamstrat...@gmail.com wrote: We are using marshal for serialising objects before distributing them around the cluster, and extremely occasionally a corrupted marshal is produced. The current workaround is to

Re: [Python-Dev] Locale-specific formatting

2010-12-18 Thread MRAB
On 18/12/2010 09:26, Martin v. Löwis wrote: Comments? How do you implement that? In particular, how do you retrieve information for different locales in a single program? The locale module would be able to return a named locale dict: loc = locale.getnamedlocale('en_UK') or: loc =

<    1   2   3   4   5   6   >