Re: [Python-Dev] Explicitly declaring expected exceptions for a block

2005-06-21 Thread Dmitry Dvoinikov
If you're trying to write tests, perhaps a better use-case would be something like: with required_exception(SomeError): do something that should cause SomeError Yes, you are right, that'd be a better and more flexible way, thank you. Sincerely, Dmitry Dvoinikov http://www.targeted.org/

Re: [Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

2005-06-21 Thread Shane Hathaway
Keith Dart wrote: I guess I just clarify this more. My unsigned type really is an object that represents a type of number from the external system. Previously, there was a nice, clean mapping between external types and Python types. Now there is not so clean a mapping. Not that that makes it a

Re: [Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

2005-06-21 Thread Guido van Rossum
On 6/20/05, Keith Dart [EMAIL PROTECTED] wrote: On Mon, 20 Jun 2005, Guido van Rossum wrote: [...] By far the easiest way to do arithmetic mod 2**32 is to just add 0x to the end of your expression. For example, simulating the effect of multiplying an unsigned long by 3 would be x =

Re: [Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

2005-06-21 Thread Guido van Rossum
On 6/20/05, Keith Dart [EMAIL PROTECTED] wrote: However, since it is sometimes necessary to interface to other systems with Python, I see no reason why Python should not have a full set of built in numeric types corresponding to the machine types and, in turn, other system types. Then it would

Re: [Python-Dev] Explicitly declaring expected exceptions for ablock

2005-06-21 Thread Michael Chermside
Dmitry Dvoinikov writes: The reason for that being self-tests with lots and lots of little code snippets like this: try: c().foo() except TypeError: pass Paul Du Boise already responded explaining that PEP 343 probably handles the task you want. I just wanted to mention that you

Re: [Python-Dev] Explicitly declaring expected exceptions for ablock

2005-06-21 Thread Dmitry Dvoinikov
I suspect that you wanted either: try: c().foo() fail('Should have raised TypeError') except TypeError: pass # expected Right, of course I use something along these lines: try: c().foo() except TypeError: pass else: assert False, c.foo() should have

Re: [Python-Dev] Recommend accepting PEP 312 -- Simple Implicit Lambda

2005-06-21 Thread Nick Coghlan
Guido van Rossum wrote: [Nick Coghlan] And here we see why I'm such a fan of the term 'deferred expression' instead of 'anonymous function'. Python's lambda expressions *are* the former, but they are emphatically *not* the latter. Let me emphatically disagree. Your POV is entirely

Re: [Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

2005-06-21 Thread Ron Adam
Keith Dart wrote: On Mon, 20 Jun 2005, Keith Dart wrote: But then I wouldn't know if it overflowed 32 bits. In my usage, the integer will be translated to an unsigned (32 bit) integer in another system (SNMP). I want to know if it will fit, and I want to know early if there will be a problem,

Re: [Python-Dev] Propose updating PEP 284 -- Integer for-loops

2005-06-21 Thread Raymond Hettinger
[Raymond] The above recommendations should get the PEP ready for judgement day. [David Eppstein] I thought judgement day already happened for this PEP in the Parade of PEPs. No? The parade's text said the main gripe was having the index in the middle, rather than right after the keyword.

Re: [Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

2005-06-21 Thread Keith Dart
On Tue, 21 Jun 2005, Guido van Rossum wrote: [two messages mixed] Huh? C unsigned ints don't flag overflow either -- they perform perfect arithmetic mod 2**32. I was talking about signed ints. Sorry about the confusion. Other scripting languages (e.g. perl) do not error on overflow. In my

Re: [Python-Dev] Explicitly declaring expected exceptions for a block

2005-06-21 Thread Dmitry Dvoinikov
It was possible in PEP 340 and in early drafts of PEP 346, but it isn't possible in PEP 343. In PEP 343, the statement template *cannot* suppress exceptions - it can react to them, and it can turn them into different exceptions, but that's all. ...doing homework... The following code,

[Python-Dev] Weekly Python Patch/Bug Summary

2005-06-21 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 338 open ( +0) / 2866 closed ( +5) / 3204 total ( +5) Bugs: 914 open ( +5) / 5060 closed (+13) / 5974 total (+18) RFE : 188 open ( +0) / 170 closed ( +0) / 358 total ( +0) New / Reopened Patches __ update

Re: [Python-Dev] Recommend accepting PEP 312 -- Simple Implicit Lambda

2005-06-21 Thread Josiah Carlson
Nick Coghlan wrote: Guido van Rossum wrote: But as long as we are describing the present state we should call a spade a spade, etc. I guess I take a syntactic view of the status quo, because, while lambdas may be implemented as anonymous functions, the current syntax doesn't let me