Re: [Python-Dev] PEP 435 - ref impl disc 2

2013-05-21 Thread Glenn Linderman
On 5/14/2013 7:16 AM, Ethan Furman wrote: Thank you for being persistent. You are correct, the value should be an IntET (at least, with a custom __new__ ;). You know, when you look at something you wrote the night before, and have no idea what you were trying to say, you know you were tired.

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Serhiy Storchaka
21.05.13 10:17, Hrvoje Niksic написав(ла): On 05/20/2013 05:15 PM, Ethan Furman wrote: 1) Do nothing and be happy I use 'raise ... from None' in my own libraries 2) Change the wording of 'During handling of the above exception, another exception occurred' (no ideas as to what at the moment)

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Hrvoje Niksic
On 05/21/2013 10:36 AM, Serhiy Storchaka wrote: The above exception was converted to the following exception: ... That makes it clear that the conversion was explicit and (hopefully) intentional, and that the latter exception supersedes the former. How do you distinguish intentional

Re: [Python-Dev] PEP 435 - ref impl disc 2

2013-05-21 Thread Glenn Linderman
On 5/20/2013 11:44 PM, Glenn Linderman wrote: On 5/14/2013 7:16 AM, Ethan Furman wrote: Thank you for being persistent. You are correct, the value should be an IntET (at least, with a custom __new__ ;). You know, when you look at something you wrote the night before, and have no idea what

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Serhiy Storchaka
21.05.13 12:28, Hrvoje Niksic написав(ла): On 05/21/2013 10:36 AM, Serhiy Storchaka wrote: The above exception was converted to the following exception: ... That makes it clear that the conversion was explicit and (hopefully) intentional, and that the latter exception supersedes the

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Hrvoje Niksic
On 05/21/2013 11:56 AM, Serhiy Storchaka wrote: try: x = d['key'] except KeyError: x = fallback('key') def fallback(key): if key not in a: raise BusinessError(...) return 1 / a[key] # possible TypeError, ZeroDivisionError, etc Yes, in that case the exception

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Nick Coghlan
On Tue, May 21, 2013 at 5:17 PM, Hrvoje Niksic hrvoje.nik...@avl.com wrote: On 05/20/2013 05:15 PM, Ethan Furman wrote: 1) Do nothing and be happy I use 'raise ... from None' in my own libraries 2) Change the wording of 'During handling of the above exception, another exception occurred'

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Serhiy Storchaka
21.05.13 13:05, Hrvoje Niksic написав(ла): On 05/21/2013 11:56 AM, Serhiy Storchaka wrote: try: x = d['key'] except KeyError: x = fallback('key') def fallback(key): if key not in a: raise BusinessError(...) return 1 / a[key] # possible TypeError,

Re: [Python-Dev] What if we didn't have repr?

2013-05-21 Thread Łukasz Langa
On 20 maj 2013, at 03:46, Guido van Rossum gu...@python.org wrote: On Sun, May 19, 2013 at 4:27 PM, Gregory P. Smith g...@krypto.org wrote: Now you've got me wondering what Python would be like if repr, `` and __repr__ never existed as language features. Upon first thoughts, I actually don't

Re: [Python-Dev] [Python-checkins] cpython (3.3): #17973: Add FAQ entry for ([], )[0] += [1] both extending and raising.

2013-05-21 Thread Nick Coghlan
On Tue, May 21, 2013 at 12:35 AM, r.david.murray python-check...@python.org wrote: Yay for having this in the FAQ, but... +If you wrote:: + +a_tuple = (1, 2) +a_tuple[0] += 1 + Traceback (most recent call last): + ... + TypeError: 'tuple' object does not support item

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Hrvoje Niksic
On 05/21/2013 02:57 PM, Serhiy Storchaka wrote: 21.05.13 13:05, Hrvoje Niksic написав(ла): On 05/21/2013 11:56 AM, Serhiy Storchaka wrote: try: x = d['key'] except KeyError: x = fallback('key') def fallback(key): if key not in a: raise BusinessError(...)

Re: [Python-Dev] What if we didn't have repr?

2013-05-21 Thread Guido van Rossum
Actually changing __str__ or __repr__ is out of the question, best we can do is discourage makingbthem different. But adding a protocol for pprint (with extra parameters to convey options) is a fair idea. I note that Nick sggested to use single-dispatch generic functions for this though. Both have

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Nick Coghlan
On Tue, May 21, 2013 at 11:23 PM, Hrvoje Niksic hrvoje.nik...@avl.com wrote: In my example code the raise keyword appears lexically inside the except clause. The compiler would automatically emit a different raise opcode in that case. Hrvoje, can we drop this subthread please. The topic was

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread R. David Murray
On Tue, 21 May 2013 01:39:03 +1000, Steven D'Aprano st...@pearwood.info wrote: On 21/05/13 00:12, Ethan Furman wrote: As a case in point, base64.py is currently getting a bug fix, and also contains this code: def b32decode(s, casefold=False, map01=None): . . .

[Python-Dev] PEP 442 delegate

2013-05-21 Thread Antoine Pitrou
Hello, I would like to nominate Benjamin as BDFL-Delegate for PEP 442. Please tell me if you would like to object :) Regards Antoine. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 442 delegate

2013-05-21 Thread Benjamin Peterson
2013/5/21 Antoine Pitrou solip...@pitrou.net: Hello, I would like to nominate Benjamin as BDFL-Delegate for PEP 442. Please tell me if you would like to object :) I think he's a scoundrel. -- Regards, Benjamin ___ Python-Dev mailing list

Re: [Python-Dev] PEP 442 delegate

2013-05-21 Thread Guido van Rossum
No objections. Benjamin, don't accept it until we've had a chance to talk this over in person. I think we'll see a lot of each other starting next week... :-) On Tue, May 21, 2013 at 9:00 AM, Benjamin Peterson benja...@python.org wrote: 2013/5/21 Antoine Pitrou solip...@pitrou.net: Hello, I

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-21 Thread Ethan Furman
On 05/21/2013 04:23 AM, Nick Coghlan wrote: On Tue, May 21, 2013 at 5:17 PM, Hrvoje Niksic hrvoje.nik...@avl.com wrote: On 05/20/2013 05:15 PM, Ethan Furman wrote: 1) Do nothing and be happy I use 'raise ... from None' in my own libraries 2) Change the wording of 'During handling of the

[Python-Dev] Is thread-safe smtpd desired/possible?

2013-05-21 Thread Sorin Stelian
Hi, I am posting this here since I could find no active maintainer of the smtpd module. In my work as a test engineer for Axis (www.axis.com) I encountered the need of having thread-safe SMTP servers. I know the use case of several SMTP servers running in concurrent threads might seem odd,

Re: [Python-Dev] Is thread-safe smtpd desired/possible?

2013-05-21 Thread R. David Murray
On Tue, 21 May 2013 18:50:23 +0200, Sorin Stelian sorin.stel...@axis.com wrote: I am posting this here since I could find no active maintainer of the smtpd module. Currently I am effectively the maintainer of that module, though other people are helping out. In my work as a test engineer

Re: [Python-Dev] What if we didn't have repr?

2013-05-21 Thread Greg Ewing
Łukasz Langa wrote: 1. Make __str__() a protocol for arbitrary string conversion. 2. Move the current __repr__() contracts, both firm and informal to a new, extensible version of pprint. -1. The purposes of repr() and pprint() are quite different. Please let's not make any sweeping changes

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-21 Thread Olemis Lang
On 5/20/13, Mark Janssen dreamingforw...@gmail.com wrote: * Doctests practically beg you to write your code first and then copy and paste terminal sessions - they're the enemy of TDD Of course , not , all the opposite . If the approach is understood correctly then the first thing test author