Re: [Python-Dev] The docs, reloaded

2007-05-22 Thread Raymond Hettinger
(more than a line or two). For a long-time, we've always said that it is okay to submit plain text doc contributions and that another person downstream would do the mark-up. We've had few takers. Raymond ___ Python-Dev mailing list Python-D

Re: [Python-Dev] nodef

2007-05-23 Thread Raymond Hettinger
, to ensure it's truly unambiguous > in the context of that use case. Right. That's why Barry and others write: missing = object() v = d.get(k, missing) That is the guaranteed way to get a unique object. Raymond ___ Python-Dev mailing l

Re: [Python-Dev] itertools addition: getitem()

2007-07-08 Thread Raymond Hettinger
sal would tend to steer people down the wrong road, away from more natural solutions to problems involving iterators. A basic step in learning the language is to differentiate between sequences and general iterators -- we should not conflate the two. Raymond _

Re: [Python-Dev] itertools addition: getitem()

2007-07-09 Thread Raymond Hettinger
s: getitem(genprimes(), -1). I'll study Walter's use case but my instincts say that adding getitem() will do more harm than good. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] Typo in itertools.dropwhile()

2007-07-12 Thread Raymond Hettinger
kip-over, etc) the first 1000 true items and it did return EVERY element from the first false to the end. It did not produce any output for the first 1000 inputs so it took a while to get to the first output (the first false). Hope that clears it up

Re: [Python-Dev] Typo in itertools.dropwhile()

2007-07-13 Thread Raymond Hettinger
[Stephen J. Turnbull] > Shouldn't the "until" in the doc be "while"? Alternatively, "true" > could be changed to "false". Yes. I'll make the change. Raymond ___ Python-Dev mailing list Pytho

Re: [Python-Dev] Terminology of "Iterable" and "Iterator"

2007-07-25 Thread Raymond Hettinger
The docs do make a distinction and generally follow the definitions given in the glossary for the tuturial. In the case of iter(collection), I prefer the current wording because the target object need not support __iter__, it is sufficient to supply a sequential __getitem__ method. Raymond

Re: [Python-Dev] frozenset C API?

2007-09-04 Thread Raymond Hettinger
sider using the abstract API: f = PyObject_CallFunction(&PyFrozenSet_Type, "(OOO)", obj1, obj2, obj3); That will roll the whole process up into one line. Hope this was helpful, Raymond --- Bill Janssen <[EMAI

Re: [Python-Dev] frozenset C API?

2007-09-04 Thread Raymond Hettinger
know where to create the n empty slots (since their location is determined by the hash value of the keys). That is a reason that the tuple/list API differs from the set/frozenet/dict API. Raymond ___ Python-Dev mailing list Python-Dev@python.or

Re: [Python-Dev] Adding concat function to itertools

2007-09-28 Thread Raymond Hettinger
ling to unnecessarily expand the module. However, for Py3k, I'm open to changing the signature for chain(). Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.o

Re: [Python-Dev] Adding concat function to itertools

2007-09-28 Thread Raymond Hettinger
[Bruce Frederiksen] >>>> I've added a new function to itertools called 'concat'. This >>>> function is >>>> much like chain, but takes all of the iterables as a single >>>> argument. [Raymond] >> Any practical use case

Re: [Python-Dev] Decimal news

2007-09-29 Thread Raymond Hettinger
If the differences are few, I prefer that you insert some conditionals that attach different functions based on the version number. That way we can keep a single version of the source that works on all of the pythons. Raymond On Sep 29, 2007, at 8:26 AM, "Thomas Wouters" <[EM

Re: [Python-Dev] Backporting Decimal

2007-10-02 Thread Raymond Hettinger
bug fixes and backported. This is especially important in this case because other errors have been fixed and the test cases have grown. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsu

Re: [Python-Dev] Backporting Decimal

2007-10-02 Thread Raymond Hettinger
ut 2.4? If there are any plans for another 2.4 release, then yes; otherwise, why bother. 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] Overflow on enumerate() and itertools.count()

2007-10-28 Thread Raymond Hettinger
For Py2.6, I fixed a long standing irritant where the count raised an OverflowError when it reached LONG_MAX. If you guys agree that is a bug fix, I'll backport it to Py2.5. Raymond ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Declaring setters with getters

2007-10-31 Thread Raymond Hettinger
ing else that wraps functions. Alternatively, the doc string could be made a little more informative: __doc__ = 'property of function %s: %s' % (f.__name__, f.__doc__) Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mai

Re: [Python-Dev] Declaring setters with getters

2007-10-31 Thread Raymond Hettinger
> and have a matching propdel decorator? -1. That would be a complete waste of builtin space. Put stuff in when it is really needed. Ideas are not required to automatically propagate from the commonly used cases to the rarely used cases. Raym

Re: [Python-Dev] Declaring setters with getters

2007-10-31 Thread Raymond Hettinger
a short, simple mnemonic to the functionality. Also, I find that these unique words are easier to search for. I once co-owned a magazine called Know Your Boston and it was very difficult for clients to find using Google. Raymond ___ Pytho

Re: [Python-Dev] New python developer

2007-11-13 Thread Raymond Hettinger
> As you may have seen, I have recently been granted developer > privileges on python svn. Hello Amaury. Welcome aboard. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Suggestions for Improvements to namedtuple

2007-11-14 Thread Raymond Hettinger
better suggestions. Also, the recipe itself is a combination of the best of prior attempts. Unfortunately, each of several commenters revisit everything from scratch and propose their own complete rewrites that ignore the requests and commments of all those who pre

Re: [Python-Dev] Suggestions for Improvements to namedtuple

2007-11-14 Thread Raymond Hettinger
for a spin). 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] Suggestions for Improvements to namedtuple

2007-11-14 Thread Raymond Hettinger
> In my opinion __replace__ should be able to replace multiple fields. This suggestion is accepted and checked-in. See revision 58975. Surprisingly, the required signature change results in improved clarity. This was an all around win. Raym

Re: [Python-Dev] Alternative C implementation idea for collections.deque

2007-11-14 Thread Raymond Hettinger
boost to the Queue module and a number of other tools that were using lists for deque-style operations. 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] Should we do away with unbound methods in Py3k?

2007-11-23 Thread Raymond Hettinger
> It looks like we're in agreement to drop unbound methods +1 It is a bit cleaner to simply return the unmodified function. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Uns

Re: [Python-Dev] PATCH: attribute lookup caching for 2.6

2007-12-05 Thread Raymond Hettinger
> I never even saw that one. I'm hoping Raymond will have another look. Great. Will review it this week. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.py

Re: [Python-Dev] PATCH: attribute lookup caching for 2.6

2007-12-05 Thread Raymond Hettinger
> Hm... [EMAIL PROTECTED] bounced. I wonder what's going on there.. I'm now in an EWT spin-off company. The new email address is [EMAIL PROTECTED] Also, I frequently check the [EMAIL PROTECTED] account too. Raymond ___ Python-Dev

Re: [Python-Dev] PEP Idea: Syntactic sugar for StopIteration.

2007-12-08 Thread Raymond Hettinger
find the meaning to be transparent and the proposal adds new syntax without adding functionality. Also, I do not find the "emtpy generator" use case to be even slightly motivating. If an empty iterator were needed for some reason, I would just write: iter([]) and be done with it. Raymo

Re: [Python-Dev] PEP Idea: Syntactic sugar for StopIteration.

2007-12-08 Thread Raymond Hettinger
In your example, why do you "raise StopIteration" instead just writing "return"? - Original Message - From: "Manuel Alejandro CerĂ³n Estrada" <[EMAIL PROTECTED]> Take a look at this example: def lines(): for line in my_file: if some_error(): raise StopIteration()

Re: [Python-Dev] PEP Idea: Syntactic sugar for StopIteration.

2007-12-08 Thread Raymond Hettinger
> 2007/12/8, Raymond Hettinger <[EMAIL PROTECTED]>: >>...the proposal adds new syntax without adding functionality. > > That is indeed the definition of syntactic sugar [1]. Python is full > of that, for example the import statement. . . . > The real problem is that >

[Python-Dev] Spurious Buildbot Reports

2007-12-19 Thread Raymond Hettinger
test_threading for example. 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] Syntax suggestion for imports

2008-01-02 Thread Raymond Hettinger
The standard library, my personal code, third-party packages, and my employer's code base are filled with examples of the following pattern: try: import threading except ImportError: import dummy_threading as threading try: import xml.etree.cElementTree as ET except ImportError: tr

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Raymond Hettinger
re problematic as "emptymodule" seems too magical. > . . . > try: >readline = None >import readline > except ImportError: >pass Perhaps "import readline or None" would have been a better way to capture that pattern as well as the "except pass

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Raymond Hettinger
eed go away in Py3.0, what is the typical pattern? 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] Return type of round, floor, and ceil in 2.6

2008-01-03 Thread Raymond Hettinger
(I think Google is still running tons of code on 2.2, 2.3, and 2.4). There needs to be a good incentive for upgrading; otherwise, Py2.6 *will* fail. The specific change suggested here is possibly (and perhaps probably) harmless; however, it is part of a larger trend that is not hea

Re: [Python-Dev] Return type of round, floor, and ceil in 2.6

2008-01-03 Thread Raymond Hettinger
tegory of things that don't provide them any benefit). > Right now, in the trunk, math.float(1) returns 1, > where it should return 1.0 for compatibility with 2.5. > Jeffrey, can you fix this and similar incompatibilities > you introduced? Thanks for zapping this. Raymond

Re: [Python-Dev] Return type of round, floor, and ceil in 2.6

2008-01-04 Thread Raymond Hettinger
it is easy to explain, it runs fast, and it is not hard to get right. my two cents, Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/pyth

Re: [Python-Dev] function call syntax oddity

2008-01-04 Thread Raymond Hettinger
[Paul Moore] > 1 .__str__() > This one is a number "1" followed by > the operator "." followed by "__str__". FWIW, I would avoid the odd spacing and write this as: (1).__str__() Raymond ___ Python-Dev

Re: [Python-Dev] Repeatability of looping over dicts

2008-01-04 Thread Raymond Hettinger
esponding to some set of keys. There are probably a lot of functions that take keys and values separately, so it would not be uncommon to call those with a pattern like: save_config(configfile, d.keys(), d.values()). In the OP's context where multiple threads are running,

Re: [Python-Dev] Rounding Decimals

2008-01-05 Thread Raymond Hettinger
ypes > that support it? That would clutter the interface. Just specify a universal rounding mode for __round__ and have Decimal's implementation of that method comply. If someone wants more control than that, they can manipulate the decim

Re: [Python-Dev] Return type of round, floor, and ceil in 2.6

2008-01-05 Thread Raymond Hettinger
[Tim] > I agree it's far from obvious to most how > to accomplish rounding using the decimal facilities. FWIW, there is an entry for this in the Decimal FAQ: http://docs.python.org/lib/decimal-faq.html Raymond ___ Python-Dev mailing list

Re: [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
more harm than good. Raymond - Original Message - From: "Jeffrey Yasskin" <[EMAIL PROTECTED]> To: "Raymond Hettinger" <[EMAIL PROTECTED]> Cc: "Mark Dickinson" <[EMAIL PROTECTED]>; "Python 3000" <[EMAIL PROTECTED]>; Sent

Re: [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
to a module that already has a huge number of methods. Our goal is to keep that module as a minimal implementation of the spec. Fattening the API will make the module harder to use, not simpler. Raymond ___ Python-Dev mailing list Python-Dev@py

Re: [Python-Dev] [Python-3000] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
[Raymond] >> There should probably be a PEP sets clearer guidelines about what should be >> backported from Py3.0. >> >> Perhaps something like this: >> * If there is a new feature that can be implemented in both and will make >> both more attractive, then it

Re: [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
die right now. The sentiment is unchanged -- please do not build-out the API for the decimal module. It is intended to be minimal and needs to stay that way. Further additions will only make it harder to use, harder to maintain, and will complicate efforts to rewrite the module in C. Raymond

Re: [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
ng, this doesn't improve Py2.6 in the least. 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] Rounding Decimals

2008-01-07 Thread Raymond Hettinger
API, please pay special attention. In this case, you are working directly against a core philosophy for the design and maintenance of the module. I admire your enthusiasm, but please hold it in check. Raymond ___ Python-Dev mailing list Python-Dev@python.o

Re: [Python-Dev] [Python-3000] Rounding Decimals

2008-01-07 Thread Raymond Hettinger
urrent proposal to add a duplicate method. If someone really cared about making the module easier to use, I would fully support efforts to write a tutorial on the fundamentals or an effort to write a client module implementing only a subset of the spec. Raymond __

[Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-07 Thread Raymond Hettinger
round module quality, duplication, and obsolence. In contrast, I do not think that introducing a hierarchy of namespaces is of interest to most users. That exercise may well make the language harder to use/learn, not easier. my-two-cents-ly, Raymond __

[Python-Dev] Backport PEP 3129: Class Decorators

2008-01-07 Thread Raymond Hettinger
This seems like something that could reasonably be added to Py2.6. 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

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Raymond Hettinger
't a common use case to need to sum two dictionaries while keeping both of the inputs unaltered. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305268. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Raymond Hettinger
time? What are the use cases? FWIW, the Py3.0 API for dicts will support some set-like operations. Perhaps, that fits the bill. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev U

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-11 Thread Raymond Hettinger
he work. (The abc.py module needs to be updated > too.) I think this would end-up being clutter, something added just because it could be done, not because we have compelling use cases that can't be met with existing dicts, sets, and lists. Raymond ___

Re: [Python-Dev] PySequence_Concat for dicts

2008-01-12 Thread Raymond Hettinger
[Raymond] >>> When does it come-up that you want a third summed dict >>> while keeping the two originals around unchanged? Does >>> it matter that the addition is non-commutative? Would >>> a + b + c produce an intermediate a/b combo and then >>> ano

[Python-Dev] r59947 - in python/trunk:Lib/test/test_structseq.py Misc/NEWS

2008-01-13 Thread Raymond Hettinger
collections.namedtuple(). The _fields tuple should only include the visible positional fields while _asdict() and _replace() should include all of the fields whether visible or accessible only by attribute access. Thanks for the nice work. Raymond _

Re: [Python-Dev] r59947 - in python/trunk:Lib/test/test_structseq.py Misc/NEWS

2008-01-13 Thread Raymond Hettinger
basically that they *are* tuples with the added nicity of attribute access and a self-documenting repr. 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] What to do for bytes in 2.6?

2008-01-17 Thread Raymond Hettinger
t jump all at once. Multiple-ways-to-do-it should not be the motto for 2.6. Instead, let's provide the best transition tools possible and keep both 2.6 and 3.0 as clean as possible (no duplicative or half-intergrated functionality). Raymond ___

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Raymond Hettinger
to have transition issues. It would be nice for us knuckle-draggers to not have to face the issue until 3.0. 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] What to do for bytes in 2.6?

2008-01-17 Thread Raymond Hettinger
; and change all of the standard library modules? Is this going to pop-up everywhere and become something you have to know about whether or not you're a volunteering forward-looking programmer? I hope not. Raymond ___ Python-Dev mailing list Python

Re: [Python-Dev] misbehaving __contains__

2008-01-22 Thread Raymond Hettinger
pressed by: for elem in container: assert elem in container It looks like changing the semantics would introduce some weirdness. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Un

Re: [Python-Dev] misbehaving __contains__

2008-01-22 Thread Raymond Hettinger
tainer. The code for sets and frozensets makes that assumption, for example. And, when the code does break, the errors will be darned hard to find. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pytho

[Python-Dev] trunc()

2008-01-24 Thread Raymond Hettinger
n the language. There are a handful of needs met by the numeric tower but they only warrant minimal changes to the language. Raymond P.S. The docstring for trunc() makes it sound like an imprecisely specified version of round(). trunc() looks like int() but it

[Python-Dev] trunc()

2008-01-24 Thread Raymond Hettinger
;m curious why trunc() ended-up in builtins instead of the math module. Doesn't it make sense to collect similar functions with similar signatures in the same place? Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/ma

[Python-Dev] trunc()

2008-01-24 Thread Raymond Hettinger
[Raymond Hettinger] > Since something similar is happening to math.ceil and math.floor, > I'm curious why trunc() ended-up in builtins instead of the math > module. Doesn't it make sense to collect similar functions > with similar signatures in the same place? [Christian H

[Python-Dev] Float --> Integer Ratio

2008-01-24 Thread Raymond Hettinger
s and ints and has no internal references to the rational module). Raymond --- def _binary_float_to_ratio(x): """x -> (top, bot), a pair of ints s.t. x = top/bot. The conversion is done exactly, without rounding.

[Python-Dev] Organization of ABC modules

2008-01-25 Thread Raymond Hettinger
ice of spreading modules these across the library isn't serving us well. 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] trunc()

2008-01-25 Thread Raymond Hettinger
with int() for making ints from the non-fractional portion of a float. 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] Organization of ABC modules

2008-01-25 Thread Raymond Hettinger
> but if Guido > likes the idea of a standard naming convention (such as the ABC suffix) > for classes that use the ABCMeta metaclass, I'd certainly be happy to go > through and update the affected classes and the code which refers to them. A prefix would be

Re: [Python-Dev] Organization of ABC modules

2008-01-25 Thread Raymond Hettinger
> If you want ABCs to be more easily recognizable > as such, perhaps we could use a naming convention, Essentially, that's all I was asking for. It doesn't really matter to me whether numbers.py gets called abc_numbers or abc.numbers. Either one would be an improv

Re: [Python-Dev] trunc()

2008-01-25 Thread Raymond Hettinger
> If the decision comes to be that int(float) should be blessed > as a correct way to truncate a float, I'd agree with Raymond > that trunc() is just duplication and should be eliminated. Yay, we've make progress! > I'd,of course, rather have a spelling that says wh

Re: [Python-Dev] [Python-checkins] r60283 - in python/trunk: Include/longintrepr.h Include/longobject.h Include/unicodeobject.h Misc/NEWS Modules/_fileio.c Objects/longobject.c Objects/unicodeobject.c

2008-01-26 Thread Raymond Hettinger
r chucks of the new model? I'm not seeing any limits on Py3.0-->Py2.6 contamination. 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] trunc()

2008-01-25 Thread Raymond Hettinger
o have frac() which has the obvious interpretation. 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] trunc()

2008-01-25 Thread Raymond Hettinger
ats rounded to n-digits. I've taught a lot of classes to spreadsheet users and have observed that people get it right away. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscrib

Re: [Python-Dev] [Python-checkins] r60283 - in python/trunk: Include/longintrepr.h Include/longobject.h Include/unicodeobject.h Misc/NEWS Modules/_fileio.c Objects/longobject.c Objects/unicodeobject.c

2008-01-26 Thread Raymond Hettinger
> 'bytearray' is a separate issue. It's a brand new type: a *mutable* > byte array. Its status as a built-in and completely different API > makes it much more convenient than using the old array module. That's reasonable. Raymond _

Re: [Python-Dev] trunc()

2008-01-26 Thread Raymond Hettinger
[Christian Heimes] > In my opinion float(complex) does do the most sensible thing. It fails > and points the user to abs(). Right. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsub

Re: [Python-Dev] trunc()

2008-01-26 Thread Raymond Hettinger
y has problems with it. The tools is ubiquitous in other languages, spreadsheets, and calculators. 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] trunc()

2008-01-26 Thread Raymond Hettinger
;s a bit weird to decide that int() needs to lose that capability so we get generalized Integrals as output. What's wrong with coercion to a concrete type? Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/lis

Re: [Python-Dev] trunc()

2008-01-27 Thread Raymond Hettinger
[Raymond Hettinger] >> The idea that programmers are confused by int(3.7)-->3 may not be nuts, but >> it doesn't match any experience I've had with any >> programmer, ever. [Christian Heimes] > You haven't been doing newbie support in #python lately. Sta

Re: [Python-Dev] trunc()

2008-01-27 Thread Raymond Hettinger
needing to decide whether to provide __trunc__ which will typically be the same thing. In time, I believe it will become self-evident that having both int() and trunc() is a wart. If trunc() goes into 2.6 and 3.0, then we're going to have to live with this for a long time. Purity m

Re: [Python-Dev] trunc()

2008-01-27 Thread Raymond Hettinger
> Then int() can be defined by deferring to trunc() > -- as opposed to round(). That part is new and represents some progress. If I understand it correctly, it means that we won't have both __int__ and __trunc__ magic methods. That's a good

Re: [Python-Dev] trunc()

2008-01-27 Thread Raymond Hettinger
[GvR] >> > - trunc(), round(), floor() and ceil() should all be built-ins, >> > corresponding to __trunc__, __round__, __floor__ and __ceil__. In Py2.6, what will the signatures be? Last I heard, ceil() and floor() were still going to be float

[Python-Dev] Py2.6 release schedule

2008-01-28 Thread Raymond Hettinger
What is the current thinking on this? Is the target still April 2008 as mentioned in PEP361? Are we going to have an alpha sometime soonish? Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] functions vs methods (was Re: trunc())

2008-01-28 Thread Raymond Hettinger
[MvL] > I wouldn't want to propose removal of len(), no. However, > I do think that adding more builtins (trunc in particular) > is bad, especially when they make perfect methods. +1 Raymond ___ Python-Dev mailing list Python-Dev@p

Re: [Python-Dev] functions vs methods (was Re: trunc())

2008-01-28 Thread Raymond Hettinger
f x>0 else math.ceil(x) elif mode==ROUND_TO_EVEN: . . . Maybe we don't need a separate function and magic method for every possible rounding mode. Also, I think there was some discussion of changing round() to use statistician's rounding. We might as well make it e

Re: [Python-Dev] functions vs methods (was Re: trunc())

2008-01-28 Thread Raymond Hettinger
rmatting on output, while in Python the same thing would > typically be done with "%.2f" % x rather than round(x, 2). +1 for deprecating the second argument to round(). Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mai

Re: [Python-Dev] functions vs methods (was Re: trunc())

2008-01-28 Thread Raymond Hettinger
mixin capabilities to automatically provide all of these given one or two of them as primitives. Raymond P.S I get no shortage of hits for searches like: http://www.google.com/search?q=truncate+string ___ Python-Dev mailing list Python-Dev@python.org h

[Python-Dev] trunc()

2008-01-28 Thread Raymond Hettinger
stare, which did not surprise me too much as it is not a common > (American) English word. Even to adults, the word has other meanings: http://en.wikipedia.org/wiki/Truncation_%28disambiguation%29 Raymond ___ Python-Dev mailing list Python-

[Python-Dev] Slot for __trunc__

2008-01-29 Thread Raymond Hettinger
Should the implementation of __trunc__ have its own slot like we have for nb_index? Raymond --- [EMAIL PROTECTED] ~/py26/Objects $ grep "__trunc__" *.c floatobject.c: {"__trunc__", (PyCFunction)float_trunc, METH

Re: [Python-Dev] Slot for __trunc__

2008-01-29 Thread Raymond Hettinger
nc() function which is currently implemented with PyObject_CallMethod(number, "__trunc__", "") instead of a fast call to a slot. Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pytho

[Python-Dev] Buildbot failures

2008-02-06 Thread Raymond Hettinger
n test_sys., "test_compact_freelists self.assert_(r[0][2] > 100, r[0][2])". Also, test_docxmlrpc hasn't been happy. One of the tests isn't getting the exact response string it expected. Any ideas what is causing this? Raymond ___ P

Re: [Python-Dev] Error from SVN commit

2008-02-09 Thread Raymond Hettinger
tions/60708-1.txn': No space left on device > -- > > I've tried it a few times over the last 5-10 minutes and got the same > error each time. I got the same a few times last night. Raymond ___ Python-Dev mailing

[Python-Dev] New math functions

2008-02-11 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

Re: [Python-Dev] Mutable sequence .sort() signature

2008-02-12 Thread Raymond Hettinger
y3.0 docs have the new signature (same as the old one but it no longer accepts a cmp function and to prevent accidents keyword arguments are required). I'm not sure where else to document it. > Does it come up in -3 warnings? It doesn't, but it wouldn't be ha

[Python-Dev] Odom

2008-02-12 Thread Raymond Hettinger
def mrange(minvec, maxvec=None): if maxvec is None: maxvec = minvec minvec = [0] * len(maxvec) vec = list(minvec) unitpos = len(vec) - 1 maxunit = maxvec[unitpos] _tuple = tuple while 1: if vec[unitpos] == maxunit: i = unitpos

[Python-Dev] dir() and __all__

2008-02-15 Thread Raymond Hettinger
_package__', '_time', 'deque', 'heapq'] >>> Queue.__all__ ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue'] I like the second one better. 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] dir() and __all__

2008-02-15 Thread Raymond Hettinger
[Raymond] >> Should dir(module) use __all__ when defined? [GvR] > It's not consistent with what dir() of a class or instance does though. > > -1. Perhaps there is another solution. Have dir() exclude objects which are modules. For example, dir(logging) would exclude

Re: [Python-Dev] Use Python 3.0 syntax for except and raise?

2008-02-17 Thread Raymond Hettinger
package will need to wait for 3.0 to use the except/as form :-( 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] Small RFEs and the Bug Tracker

2008-02-18 Thread Raymond Hettinger
ner cases (like handling empty matches or speeding-up badly designed regexes). Those bug reports and rfes are valid and should be left open unless a module author decides that re's won't support the request. Raymond ___ Python-Dev maili

Re: [Python-Dev] Backporting PEP 3127 to trunk

2008-02-21 Thread Raymond Hettinger
[Eric Smith] > I'm going to work on backporting PEP 3127, specifically >the hex, oct(), and bin() builtins. IMO, these should not be backported. They are strongly associated with 3.0's new literal syntax. They don't don't really fit in with 2.6 and don't make 2.6

Re: [Python-Dev] dir() and __all__

2008-02-21 Thread Raymond Hettinger
ut the API. He was thrown-off by some of the entries in dir(logging). 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%

Re: [Python-Dev] Backporting PEP 3127 to trunk

2008-02-21 Thread Raymond Hettinger
ill create a confused mess, IMO. We should draw the line on Py3.0 backports whenever the two different models would be conflated (i.e. str/unicode vs bytes/text or 0123 vs 0o123). Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.p

<    3   4   5   6   7   8   9   10   11   12   >