Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
se looking for some places to apply the idea and have come up empty handed. This could mean that I've not yet grasped the essence of what makes the idea useful or it may have other implications such as apps needing to be designed from the ground-up

Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
[Raymond] > > Likewise, is it correct that "yield" is anti-parallel to the current > > meaning? Inside a generator, it returns control upwards to the caller. > > But inside a block-iterator, it pushes control downwards (?inwards) to > > the block it controls.

Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
to me that the word "block" already has meaning in the context of threading.Lock.acquire() which has an optional blocking argument defaulting to 1. In example 4, consider adding a comment that the "continue" has its normal (non-extending) meaning. The examples should demonstra

Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
effect on timings. It's too early for that discussion, but keep it in mind. That's pretty much it for my first readings of the PEP. All-in-all it has come together nicely. 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

Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
exit__() didn't > raise RuntimeError("or some other exception") > > I'd like the block statement to be defined exclusively in terms of > __exit__() though. That sounds like a winner. Raymond ___ Python-Dev mailing

Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
he cover announcement should impart the initial spin as a request for the community to create, explore, and learn from use cases. That will help make the discussion more constructive, less abstract, and more grounded in reality (wishful thinking). That probably beats, "Here's 3500 words of

Re: [Python-Dev] PEP 340 -- concept clarification

2005-05-03 Thread Raymond Hettinger
ious right-thing-to-do will be influenced by what happens with 340. Everyone's bandwidth is being maxed-out at this stage. So it is somewhat helpful to keep focused on the core proposal of generator driven block/suite thingies. Raymond ___ Python

Re: [Python-Dev] my first post: asking about a "decorator" module

2005-05-04 Thread Raymond Hettinger
not a good idea. Putting tools in the standard library should be the last evolutionary step, not the first. Raymond Hettinger ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.p

Re: [Python-Dev] my first post: asking about a "decorator" module

2005-05-05 Thread Raymond Hettinger
ing several ASPN recipes and a wiki: http://www.python.org/moin/PythonDecoratorLibrary 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

Re: [Python-Dev] my first post: asking about a "decorator" module

2005-05-06 Thread Raymond Hettinger
e improper, in the sense that they change the signature of > the function they decorate. Signature changing and signature preserving are probably better classifications than proper and improper. Even then, some decorators like atexit() and classmethod() may war

Re: [Python-Dev] Breaking off Enhanced Iterators PEP from PEP 340

2005-05-06 Thread Raymond Hettinger
g that it's not > countering those items nor repeating them. If someone volunteers to split it out for you, I think it would be worthwhile. Right now, the PEP is hard to swallow in one bite. Improving its digestibility would be a big help when the PEP is offered up to the tender mercies to comp.l

Re: [Python-Dev] The decorator module

2005-05-08 Thread Raymond Hettinger
func.func_defaults, func.func_closure) > > and I *hate* it! Sounds reasonable. Choices: - submit a patch adding a __copy__ method to functions, - submit a patch for the copy module, or - submit a feature request, assign to me, and wait. Raymond Hettinger __

Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.8, 1.9

2005-05-14 Thread Raymond Hettinger
> -was, under the covers, a (optential) looping construct. This > +was, under the covers, a (potential) looping construct. This I'm glad I didn't fix this one. I thought he meant to use "optional". Raymond Hettinger

Re: [Python-Dev] Example for PEP 343

2005-05-17 Thread Raymond Hettinger
, alter, and then restore: oldprec = decimal.getcontext().prec decimal.getcontext().prec += 2 yield None decimal.getcontext().prec = oldprec 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

Re: [Python-Dev] Example for PEP 343

2005-05-17 Thread Raymond Hettinger
he original -- the important change was the absolute save and restore versus the original relative adjust up and adjust down. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubsc

Re: [Python-Dev] Example for PEP 343

2005-05-17 Thread Raymond Hettinger
e whole context and let the wrapped block only work with a copy. oldcontext = decimal.getcontext() newcontext = oldcontext.copy() newcontext.prec += 2 yield None decimal.setcontext(oldcontext) This approach defends against various kinds of unruly behavior by the

Re: [Python-Dev] Example for PEP 343

2005-05-17 Thread Raymond Hettinger
> I think you're missing a decimal.setcontext(newcontext) before the > yield.. Right. ___ 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/arc

Re: [Python-Dev] Example for PEP 343

2005-05-17 Thread Raymond Hettinger
make sure the context gets restored even if an exception is raised at some unexpected point in the middle of the computation. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsu

Re: [Python-Dev] [Python-checkins] python/nondist/peps pep-0343.txt, 1.11, 1.12

2005-05-17 Thread Raymond Hettinger
following example shows the kind of oddity that can arise when working with quantities that have not been rounded to the current precision: >>> from decimal import getcontext, Decimal as D >>> getcontext().prec = 3 >>> D(&#

[Python-Dev] Adventures with Decimal

2005-05-17 Thread Raymond Hettinger
[Raymond] > > The following example shows the kind of oddity that can arise when > > working with quantities that have not been rounded to the current > precision: > > > > >>> from decimal import getcontext, Decimal as D > > >>> getcontext().p

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325: generatorexceptions and cleanup

2005-05-18 Thread Raymond Hettinger
backwards compatability, it introduces yet another new/old style distinction where we have to keep both forms in perpetuity. 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

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325:generator exceptions and cleanup

2005-05-18 Thread Raymond Hettinger
ution to long standing issues. I would rather not have it contaminated with distracting issues and co-routine dreams. 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

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325: generator exceptions and cleanup

2005-05-18 Thread Raymond Hettinger
> Okay. Maybe we should just update PEP 325, then? -1. Keep this separate. 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-

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325: generatorexceptions and cleanup

2005-05-18 Thread Raymond Hettinger
> [Raymond Hettinger] > > Are the value and traceback arguments optional as they are with the > > current raise statement? If they are optional, what would the default > > be? I think the preferred choice is to have the call to the throw > > method be the anchor po

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325:generator exceptions and cleanup

2005-05-18 Thread Raymond Hettinger
O). > > If either of those PEP authors feels like updating their PEP, they > have my blessings! I probably won't get to writing my own for a few > more days. Okay, I volunteer to recast PEP 288 to encompass your combined proposa

Re: [Python-Dev] Decimal construction

2005-05-19 Thread Raymond Hettinger
is alone and simply document the best practices (using unary plus after a precision change and constructing using create_decimal whenever context is important to construction). Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.p

Re: [Python-Dev] Combining the best of PEP 288 and PEP 325:generator exceptions and cleanup

2005-05-19 Thread Raymond Hettinger
hen > ignoring it). Raymond take notice if you're still working on the PEP. Got 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/

Re: [Python-Dev] Adventures with Decimal

2005-05-19 Thread Raymond Hettinger
[Tim suggesting that I'm clueless and dazzled by sparkling lights] > There seems to be an unspoken "wow that's cool!" kind of belief > that because Python's Decimal representation is _potentially_ > unbounded, the constructor should build an object big enough to > hold any argument exactly (up t

Re: [Python-Dev] Adventures with Decimal

2005-05-19 Thread Raymond Hettinger
decimal design rationale to schoolbook math --- I can't find this link. If someone remembers, please post it. Okay, I've said my piece. Do what you will. Raymond ___ Pytho

Re: [Python-Dev] Adventures with Decimal

2005-05-20 Thread Raymond Hettinger
Be careful with this proposed change. It is a can of worms. Better yet, don't do it. We already have a context aware constructor method if that is what you really want. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.o

Re: [Python-Dev] Adventures with Decimal

2005-05-20 Thread Raymond Hettinger
ally, the implementation relies on the existing behavior so it is not easily changed. Don't do it. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/

Re: [Python-Dev] Adventures with Decimal

2005-05-20 Thread Raymond Hettinger
ontext traps InvalidOperation, an exception is raised; otherwise, the constructor returns a new Decimal with the value of NaN. """ Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-de

Re: [Python-Dev] Adventures with Decimal

2005-05-20 Thread Raymond Hettinger
[Guido] > > You know that, but Raymond seems confused. From one of his posts (point > (k)): [Raymond] > > "Throughout the implementation, the code calls the Decimal > > constructor to create intermediate values. Every one of those calls > > would need to

Re: [Python-Dev] Adventures with Decimal

2005-05-20 Thread Raymond Hettinger
>> d.getcontext().prec = 4 >>> d.getcontext().create_decimal("1.234567890123456789012345678901234567890 123456789") Decimal("1.235") 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

Re: [Python-Dev] Adventures with Decimal

2005-05-20 Thread Raymond Hettinger
harm in allowing any context free construction while I see greater harm from re-introducing representation error when that is what we were trying to fix in the first place. The rest is just practicalities and engineering (altering decimal's internals may be a non-trivial undertaking)

[Python-Dev] Decimal FAQ

2005-05-22 Thread Raymond Hettinger
Some of the private email I've received indicates a need for a decimal FAQ that would shorten the module's learning curve. A discussion draft follows. Raymond --- Q. It is cumbersome to type decimal.Decimal('1234.5')

Re: [Python-Dev] Request for dev permissions

2005-05-28 Thread Raymond Hettinger
tart out with CVS tracker permissions. When you have a patch that is really to apply, upload it to the tracker and assign to me. Raymond Hettinger ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyth

Re: [Python-Dev] Request for dev permissions

2005-05-28 Thread Raymond Hettinger
> Let's start out with CVS tracker permissions. > When you have a patch that is really to apply, > upload it to the tracker and assign to me. really --> ready ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyth

Re: [Python-Dev] Old Python version categories in Bug Tracker

2005-05-30 Thread Raymond Hettinger
;s no harm in having these surface. If the category is accurate, let's use it. If the bug is out of date, we can mark it as such and close it. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python

[Python-Dev] Closing old bugs

2005-05-31 Thread Raymond Hettinger
ot a real problem in practice). Raymond P.S. When setting a time deadline for an OP to respond, we should use some terminology other than "deprecated". The word doesn't fit well and can be confused with the unrelated topic of module or feature deprecation. ___

Re: [Python-Dev] PEP 342/343 status?

2005-05-31 Thread Raymond Hettinger
> If Raymond would rather defer to me, I can give it a shot in a revised > version of PEP 343, Thanks, that would be great. The decimal conversation used up a lot of my available cycles. Raymond ___ Python-Dev mailing list Python-Dev@pyth

[Python-Dev] Closing old bugs

2005-06-01 Thread Raymond Hettinger
r policy. Is there anyone else on python-dev who thinks it's a bad idea to automatically close reports without checking whether the issue is real? 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

Re: [Python-Dev] Closing old bugs

2005-06-02 Thread Raymond Hettinger
ssing the particular issue in question. Go recruit some qualified developers. Or just find a bug that interests you and fix it. Closing bugs without reading them is an anti-contribution. If it were a best practice, then there would already be a cron job in place to do it automatically. Raymond

Re: [Python-Dev] [Python-checkins] python/dist/src/Lib sre_compile.py, 1.57, 1.58

2005-06-02 Thread Raymond Hettinger
gt; skipyes = _len(code); emit(0) > _compile(code, av[1], flags) > if av[2]: The times two operation also occurs twice in nearby code. Are those also incorrect? Raymond Hettinger ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] Thoughts on stdlib evolvement

2005-06-06 Thread Raymond Hettinger
a wonderful, must-have addition. 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

Re: [Python-Dev] Thoughts on stdlib evolvement

2005-06-06 Thread Raymond Hettinger
he standard library. Rewritten: If Fredrik Lundh were supportive of the idea, I think the Standard Library would benefit greatly from incorporating ElementTree. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/

Re: [Python-Dev] PEP 343 - next steps

2005-06-10 Thread Raymond Hettinger
re else (what is thrown at or into). It is simple, clear, and tends to suggest all the right things. I have no doubt that someone can point out differing semantics in other languages but I don't care. The verbal cue is what we are after. Raymond __

[Python-Dev] Wishlist: dowhile

2005-06-12 Thread Raymond Hettinger
: being the equivalent of; _firstpass = True while _firstpass or : _firstpass = False Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http

Re: [Python-Dev] Multiple expression eval in compound if statement?

2005-06-12 Thread Raymond Hettinger
). I can currently recognize such constructs and am working > on > code generation. I think it unwise to allow x to be any expression. Besides altering existing semantics, it leads to code redundancy and to a fragile construct (where the slightest alte

Re: [Python-Dev] Wishlist: dowhile

2005-06-12 Thread Raymond Hettinger
ust don't fit the Python mold. In contrast, the dowhile solution only takes about 30 seconds to get used to. Maybe that idea should follow the path of the genexp PEP, get rejected now, and then get resurrected as a bright idea two years from now. Or ma

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread Raymond Hettinger
[BJörn Lindqvist] > I would like to have do-while's like this: > > do: > > until > > But I'm sure that has problems too. That looks nice to me. Raymond ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread Raymond Hettinger
[Jp Calderone] > Anything can be a for loop. > > for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''): > f2.write(chunk) It would be nice to have this encapsulated in a file method: for chunk in f1.iterblocks(CHUNK_SIZE): f2.

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread Raymond Hettinger
t what you want, there would need to be a new method in the file API. The reason is roughly similar to why we have iteritems as part of the mapping API and not as a standalone itertool. for data in inp.read(blocksize): . . . Raymond ___ P

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread Raymond Hettinger
r inp. itertools work with generic iterators, not ones with a specific API. Law of Demeter. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/option

Re: [Python-Dev] Wishlist: dowhile

2005-06-14 Thread Raymond Hettinger
[Bob] > islice depends on __getitem__. Incorrect. It uses the iterator protocol. ___ 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

[Python-Dev] PEP 343 question

2005-06-15 Thread Raymond Hettinger
.     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

[Python-Dev] Withdrawn PEP 288 and thoughts on PEP 342

2005-06-16 Thread Raymond Hettinger
r, how 342 intends to overcome the off-by-one issue, how it addresses all of the other objections leveled at the now dead PEP 288, and why no one appears concerned about introducing yet another new-style/old-style issue that will live in perpetuity. Raymond Sidenote: generator attributes also fa

[Python-Dev] Propose to reject PEP 265 -- Sorting Dictionaries by Value

2005-06-16 Thread Raymond Hettinger
to the more likely use case of wanting the access only the largest counts: >>> nlargest(2, d.iteritems(), itemgetter(1)) [('b', 23), ('d', 17)] Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyt

[Python-Dev] Propose to reject PEP 281 -- Loop Counter Iteration with range and xrange

2005-06-16 Thread Raymond Hettinger
The need for the indices() proposal was mostly met by PEP 279's enumerate() builtin. Commenting on 279 before it was accepted for Py2.3, PEP 281's author, Magnus Lie Hetland, wrote, "I'm quite happy to have it make PEP 281

Re: [Python-Dev] Withdrawn PEP 288 and thoughts on PEP 342

2005-06-16 Thread Raymond Hettinger
f retirement a few months ago. Guido hated every variation of argument passing and frequently quipped that data passing was trivially accomplished though mutable arguments to a generator, through class based iterators, or via a global variable. I believe al

Re: [Python-Dev] Withdrawn PEP 288 and thoughts on PEP 342

2005-06-16 Thread Raymond Hettinger
clarity, explainability, obviousness, usefulness, and necessity. IMO, it fails most of those tests. I would not look forward to explaining "continue EXPR" in the tutorial and think it would stand out as an anti-feature. Raymond ___ Python-D

[Python-Dev] Propose to reject PEP 276 -- Simple iterator for ints

2005-06-16 Thread Raymond Hettinger
a syntax error and would become valid: x, = 1 The proposal adds iterability to all integers but silently does nothing for negative values. A minor additional concern is that floats are not given an equivalent capability (for obvious reasons) but this breaks sym

[Python-Dev] Propose to reject PEP 313 -- Adding Roman Numeral Literals to Python

2005-06-16 Thread Raymond Hettinger
://hrsbstaff.ednet.ns.ca/waymac/History%20A/A%20Term%201/1.%20Rome/R oman_Numerals.htm http://www.sizes.com/numbers/roman_numerals.htm Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

[Python-Dev] Propose to reject PEP 336 -- Make None Callable

2005-06-16 Thread Raymond Hettinger
as default arguments or indicating values that are not applicable). Mysteriously, the PEP consumes only *args but not **kwargs. It also fails with respect to clarity and explicitness. Defining a short, explicit default function is a hands-down winner in these two important measures of merit.

[Python-Dev] Propose rejection of PEPs 239 and 240 -- a builtin rational type and rational literals

2005-06-17 Thread Raymond Hettinger
, multiple contexts, and alternate rounding modes have been fully thought out.   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] Propose rejection of PEP 303 -- Extend divmod() for Multiple Divisors

2005-06-17 Thread Raymond Hettinger
ingle accumulation recipe that would work with a variety of binary operators. Executive summary: cute, but unpersuasive and unnecessary, not worth the time to code, test, document, maintain, and explain. Raymond ___ Python-Dev mailing list Pytho

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

2005-06-17 Thread Raymond Hettinger
which only targets simple, obvious cases. The discussed extensions are unattractive and should be skipped. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http

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

2005-06-17 Thread Raymond Hettinger
IIRC, there was a decision to not implement phase C and to keep the trailing L in representations of long integers. If so, I believe the PEP can be marked as final. We've done all we're going to do. Raymond ___ Python-Dev mailing list

Re: [Python-Dev] Withdrawn PEP 288 and thoughts on PEP 342

2005-06-17 Thread Raymond Hettinger
apana.org.au/~abo/projects/utils/ Thank both of you for the excellent posts. This is exactly kind of feedback and analysis that will show whether continue EXPR is worth 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

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

2005-06-18 Thread Raymond Hettinger
warnings in place for Py2.5. There is no need to exacerbate the problem. Alternately, simplify the issue by declaring that the values will be handled as if by xrange(). The above recommendations should get the PEP ready for judgement day. Good luck. Raymond _

Re: [Python-Dev] Multiple expression eval in compound if statement?

2005-06-18 Thread Raymond Hettinger
[Raymond Hettinger] > > I think it unwise to allow x to be any expression. Besides altering > > existing semantics, it leads to code redundancy and to a fragile > > construct (where the slightest alteration of any of the expressions > > triggers a silent reversion to O(n)

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

2005-06-18 Thread Raymond Hettinger
[Raymond Hettinger] > > > I recommend that the proposed syntax be altered to be more parallel > > > with the existing for-loop syntax to make it more parsable for both > > > humans and for the compiler. [Michael Hudson] > > Although all your suggestions are imp

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

2005-06-18 Thread Raymond Hettinger
f we want to be on the leading edge, we can't be copying what was done years ago in Lua. ;-) Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/opt

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

2005-06-18 Thread Raymond Hettinger
best unpleasant). Also, the naming is off -- 'def' defines some variable name. In Lua, the 'def' is called 'function' which doesn't imply a variable assignment. Raymond ___ Python-Dev mailing list Python-Dev@python

[Python-Dev] Propose to reject PEP 294 -- Type Names in the types Module

2005-06-18 Thread Raymond Hettinger
no one will likely find the benefit to be perceptible. Suggest rejecting this PEP and making a note for Py3.0 to either sync-up the type names or abandon the types module entirely. Raymond ___ Python-Dev mailing list Python-Dev@python.org http

[Python-Dev] Question about PEP 330 -- Python Bytecode Verification

2005-06-18 Thread Raymond Hettinger
feeling of security. I think not. There isn't anything wrong with having a verifier module, but I can't think of any benefit that would warrant changing the bytecode semantics just to facilitate one of the static stack checks. Raymond ___

[Python-Dev] Propose to close PEP 254 -- Making Classes Look More Like Types

2005-06-19 Thread Raymond Hettinger
This PEP is an empty stub that is unlikely to ever get filled-out in a way that adds anything beyond what is already implemented and documented. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python

Re: [Python-Dev] nice()

2006-02-13 Thread Raymond Hettinger
Please do not spam multiple mail lists with these posts (edu-sig, python-dev, and tutor). Raymond - Original Message - From: "Smith" <[EMAIL PROTECTED]> To: Cc: ; Sent: Monday, February 13, 2006 12:10 PM Subject: Re: [

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Raymond Hettinger
[Guido van Rossum] > Somewhat controversial: > > - bytes("abc") == bytes(map(ord, "abc")) At first glance, this seems obvious and necessary, so if it's somewhat controversial, then I'm missing something. What's the issue? Raymond __

Re: [Python-Dev] nice()

2006-02-15 Thread Raymond Hettinger
o come up with relative and absolute tolerances that make their application succeed over the full domain of possible inputs). Raymond relevant posts from Greg and Terry [Greg Ewing] >> I don't think you're doing anyone any favours by trying to protect >> them fr

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Raymond Hettinger
): dd[word].append(word) 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

Re: [Python-Dev] Proposal: defaultdict

2006-02-17 Thread Raymond Hettinger
> My conclusion is that setdefault() is a failure -- it was a > well-intentioned construct, but doesn't actually create more readable > code. It was an across the board failure: naming, clarity, efficiency. Can we agree to slate dict.setdefault() to disappear in Py

Re: [Python-Dev] Proposal: defaultdict

2006-02-18 Thread Raymond Hettinger
's the right way to avoid Liskov violations from altered invariants and API changes. Besides, with Python's propensity for duck typing, there's no reason to subclass when we don't have to. Raymond ___ Python-Dev mailing list Python-

Re: [Python-Dev] Proposal: defaultdict

2006-02-18 Thread Raymond Hettinger
del d[some_key] assert some_key not in 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

Re: [Python-Dev] Proposal: defaultdict

2006-02-18 Thread Raymond Hettinger
over the whole contents? If the latter, then do you worry that "dd[v]=k" does not imply "(k,v) in dd.items()"? Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubsc

Re: [Python-Dev] Proposal: defaultdict

2006-02-18 Thread Raymond Hettinger
g invariant that "k in dd" implies "k in dd.keys()"? Is the notion of __contains__ at odds with notion of universality? Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-d

Re: [Python-Dev] New Module: CommandLoop

2006-02-19 Thread Raymond Hettinger
rt(lambda a, b: cmp(a.aliases[0], b.aliases[0])) to: self._cmds.sort(key=operator.itemgetter(0)) or if you want to avoid module dependencies: self._cmds.sort(key=lambda a: a[0]) 4) In _preCommand, the sort simplifies from:

Re: [Python-Dev] New Module: CommandLoop

2006-02-19 Thread Raymond Hettinger
[Raymond Hettinger] > 1) The "chars" variable can be eliminated and the "while chars" and > "c=chars.pop(0)" sequence simplified to just: >for c in reversed(str): Actually, that should have been just:

Re: [Python-Dev] New Module: CommandLoop

2006-02-19 Thread Raymond Hettinger
lines. BTW, addspec() could be made completely general by supporting all possible keywords at once: def addspec(**kwds): def decorator(func): func.__dict__.update(kwds) return func return decorator With an open definition like that, users can specify new attributes with

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Raymond Hettinger
or not. That makes sense, though it seems over-the-top to need a zero-factory for a multiset. An alternative is to have two possible attributes: d.default_factory = list or d.default_value = 0 with an exception being raised when both are defined (the test is done when the a

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Raymond Hettinger
[Crutcher Dunnavant ] >> There are many times that I want d[key] to give me a value even when >> it isn't defined, but that doesn't always mean I want to _save_ that >> value in the dict. How does that differ from the existin

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Raymond Hettinger
t to do the initial setup in two lines, a classmethod could serve as an alternate constructor (leaving the regular contructor fully interchangeable with dicts): dd = defaultdict.setup(list, {'k1':'v1', 'k2:v2'}) or when t

Re: [Python-Dev] defaultdict proposal round three

2006-02-20 Thread Raymond Hettinger
W, I'm happy with the proposal and think it is a nice addition to Py2.5. 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

Re: [Python-Dev] defaultdict proposal round three

2006-02-21 Thread Raymond Hettinger
; on the other hand is associated with nothing. You might as well argue to call it magicdictionary because "magic" has two letters less than "default" ;-) 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

Re: [Python-Dev] defaultdict proposal round three

2006-02-21 Thread Raymond Hettinger
Then you will likely be happy with Guido's current version of the patch. - Original Message - From: "Crutcher Dunnavant" <[EMAIL PROTECTED]> To: "Raymond Hettinger" <[EMAIL PROTECTED]> Cc: "Python Dev" Sent: Monday, February 20, 200

Re: [Python-Dev] s/bytes/octet/ [Was:Re: bytes.from_hex() [Was: PEP332 revival in coordination with pep 349?]]

2006-02-21 Thread Raymond Hettinger
> Speaking of which, I suspect it'll be a lot more common to need integer > objects in the full range [0, 255] than it is now. > > Perhaps we should extend the pre-allocated integer objects to cover the > full byte range. +1 ___ Python-Dev mailing list

Re: [Python-Dev] defaultdict proposal round three

2006-02-21 Thread Raymond Hettinger
memory and make the code readable. Try to resist generalizing the name into nothingness. 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

[Python-Dev] defaultdict and on_missing()

2006-02-22 Thread Raymond Hettinger
fficult.   My recommendation:  Dump the on_missing() hook.  That leaves the dict API unmolested and allows a more straight-forward implementation/explanation of collections.default_dict or whatever it ends-up being named.  The result is delightfully s

Re: [Python-Dev] operator.is*Type

2006-02-22 Thread Raymond Hettinger
ct. The "anything" class can be viewed as either a sequence or a mapping. In this and other posts, you seem to be focusing your design around notions of strong typing and mandatory interfaces. I would suggest that that approach is futile unless you control all of the code being

Re: [Python-Dev] defaultdict proposal round three

2006-02-22 Thread Raymond Hettinger
get exactly the same beginner's error we > already have with function defaults: That makes sense. I'm somewhat happy with the patch as it stands now. The only part that needs serious rethinking is putting on_missing() in regular dicts. See my other email on that subject. Ra

<    7   8   9   10   11   12   13   14   15   >