Re: [Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses

2008-07-15 Thread Steven D'Aprano
On Tue, 15 Jul 2008 06:32:53 pm Stephen J. Turnbull wrote: > Steven D'Aprano writes: > > On Mon, 14 Jul 2008 04:27:40 pm Stephen J. Turnbull wrote: > > > FWIW, I meant 10 != not not 10. > > > > > >>> 10 != not not 10 >

Re: [Python-Dev] PEP: Consolidating names in the `unittest` module

2008-07-15 Thread Steven D'Aprano
On Wed, 16 Jul 2008 08:13:22 am Guido van Rossum wrote: > > Tests in the standard distribution which use the deprecated > > style will need to be converted. Steven d'Aprano claims this is > > nontrivial (and thus error- prone) in some cases. I haven't seen > &g

Re: [Python-Dev] Proposed unittest changes

2008-07-16 Thread Steven D'Aprano
uite midway in weight between doctests and unittest, so I will check it out. -- Steven ___ 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] Matrix product

2008-07-26 Thread Steven D'Aprano
principle. E.g. the vector cross product: (a*b)*c != a*(b*c) in general. I think a product() function that multiplies the arguments from left to right would be useful. But it won't solve the problems that people want custom operators to solve. I'm not even sure if it will solve the prob

Re: [Python-Dev] Memory Error while reading large file

2008-07-31 Thread Steven D'Aprano
ompiler, not for writing Python programs. I'll save you some time: when you post to comp.lang.python, you should post the actual error message you get, and the code that fails. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mai

Re: [Python-Dev] performance

2008-08-24 Thread Steven D'Aprano
er people, but I often compare floats with ints. Here's a contrived example: x = some_float() if x == -1: return -2 else: return (x**2-1)/(x+1) I suppose it's no hardship to start writing float literals instead of int literals, if needed. -- Steven

Re: [Python-Dev] subprocess insufficiently platform-independent?

2008-08-25 Thread Steven Bethard
On Mon, Aug 25, 2008 at 11:30 AM, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Aug 25, 2008, at 1:13 PM, Guido van Rossum wrote: > >> Several people at Google seem to have independently discovered that >> despite all of the platform-independent goodness in subprocess.py, you >> still need to be pla

Re: [Python-Dev] confusing exec error message in 3.0

2008-08-27 Thread Steven D'Aprano
d(parrot) >>> parrot.__file__ 'parrot.pyc' I don't think M.__file__ should lie and say it was loaded from a file that it wasn't loaded from. It's useful to be able to look at a module and see what file it was actually loaded from. -- Steven _

Re: [Python-Dev] confusing exec error message in 3.0

2008-08-27 Thread Steven D'Aprano
On Thu, 28 Aug 2008 01:38:14 pm Guido van Rossum wrote: > On Wed, Aug 27, 2008 at 6:21 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... > > I don't think M.__file__ should lie and say it was loaded from a > > file that it wasn't loaded from. It's usef

Re: [Python-Dev] Further PEP 8 compliance issues in threading and multiprocessing

2008-09-02 Thread Steven D'Aprano
better written as f = function And yet threading.py has at least six examples just like that. What am I missing? -- Steven ___ 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] ',' precedence in documentation]

2008-09-16 Thread Steven D'Aprano
On Tue, 16 Sep 2008 10:50:45 am Greg Ewing wrote: > Steven D'Aprano wrote: > > I was confused about the role of commas, and totally gobsmacked > > when I discovered that commas make tuples everywhere except when > > following an except statement. > > Um... you'

Re: [Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

2008-09-29 Thread Steven Bethard
On Mon, Sep 29, 2008 at 6:07 AM, Victor Stinner <[EMAIL PROTECTED]> wrote: > The default behaviour should be to use unicode and raise an error if > conversion to unicode fails. It should also be possible to use bytes using > bytes arguments and optional arguments (for getcwd). > > - listdir(unicod

Re: [Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

2008-09-30 Thread Steven D'Aprano
to easily see all such hidden files if you ask. (Almost all. Windows has "superhidden" files that remain hidden even when the user asks to see hidden files, all the better to hide malware. But that's a rant for another list.) -- Steven __

Re: [Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

2008-09-30 Thread Steven D'Aprano
n Unix). Sorry, maybe I'm just being thick here, but I don't understand how that is possible. On the physical disk, each Windows file name must be represented by a byte string, yes? So how is it possible that there are Windows files with names that can't be represented as a byte

Re: [Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

2008-09-30 Thread Steven D'Aprano
On Wed, 1 Oct 2008 09:21:37 am you wrote: > On Tue, Sep 30, 2008 at 4:08 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > On Wed, 1 Oct 2008 07:40:01 am Martin v. Löwis wrote: > >> >> On Windows, we might reject bytes filenames for all file > >> &

Re: [Python-Dev] RELEASED Python 2.6 final

2008-10-01 Thread Steven D'Aprano
very much for your hard work and for making such a great language. Cheers! -- Steven ___ 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/

Re: [Python-Dev] if-syntax for regular for-loops

2008-10-03 Thread Steven D'Aprano
For subclassing exceptions: class MyTypeError(TypeError): pass * As a placeholder for code I haven't written yet. * As a no-op used in, e.g. the timeit module. And probably a few other places as well. -- Steven ___ Python-Dev mailing

Re: [Python-Dev] __getattr__ and new style classes

2008-10-08 Thread Steven D'Aprano
significant. >>> min(Timer('d.foo', s).repeat()) 1.9228429794311523 >>> min(Timer('d2.foo', s).repeat()) 2.1040639877319336 >>> min(Timer('d.bar', s).repeat()) 0.68272304534912109 >>> min(Timer('d2.bar', s).repeat()) 0.4194

Re: [Python-Dev] compiler optimizations: collecting ideas

2008-11-14 Thread Steven D'Aprano
ization > that we could have a look at Even though the PEP has been rejected, I do like the idea of optimising chains of if...elif: http://www.python.org/dev/peps/pep-0275/ -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mai

Re: [Python-Dev] __import__ problems

2008-11-28 Thread Steven D'Aprano
the three-line idiom: the three-liner is short, simple, obvious, readable and explicit, but your solution would be even shorter, more readable, and more explicit. I think it loses on the obvious and possibly on simple. The advantage is you've already done the work rather than expecting som

Re: [Python-Dev] __import__ problems

2008-11-28 Thread Steven D'Aprano
s the feature is required by > Python's internal import system. That may very well be true, but I don't know why you're dumping on me. It wasn't my suggestion to change __import__. I merely said I could see some advantages to it. I spent most of my post telling the OP wh

Re: [Python-Dev] __import__ problems

2008-11-28 Thread Steven D'Aprano
On Sat, 29 Nov 2008 05:20:01 am Alex Martelli wrote: > On Fri, Nov 28, 2008 at 9:47 AM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > On Sat, 29 Nov 2008 03:30:49 am Christian Heimes wrote: > > ... > > > >> May I point you to the two leading unders

Re: [Python-Dev] __import__ problems

2008-11-28 Thread Steven D'Aprano
On Sat, 29 Nov 2008 01:56:00 pm Nick Coghlan wrote: > Steven D'Aprano wrote: > > Should this be reported as a documentation bug? Given the new > > import hooks, would it be fair to say that the main reason for > > __import__ is to use it to import a module whose name is

Re: [Python-Dev] Python-3.0, unicode, and os.environ

2008-12-05 Thread Steven D'Aprano
ault, if a filename in path is not a valid string, an exception is raised, with the guilty file name given in bytes as an attribute of the exception. If silence_errors is true, the invalid file names are silently skipped. -- Steven ___ Python-Dev mai

Re: [Python-Dev] RELEASED Python 3.0 final

2008-12-05 Thread Steven D'Aprano
r a decade now, and the first third party library I've downloaded and used was Pyparsing a month or two ago. I'll be the first to admit that my programs tend to be on the small size, but they're useful to me. The lack of third party libraries to Python 3 is

Re: [Python-Dev] Python-3.0, unicode, and os.environ

2008-12-05 Thread Steven D'Aprano
is quite reasonable to expect applications to deal with undisplayable filenames: displaying the name and opening the file are orthogonal concepts, although I accept that command-line interfaces will have difficulty with file names that can't be typed

Re: [Python-Dev] Self in method body

2008-12-08 Thread Steven D'Aprano
becomes vanishingly trivial when you factor in that most of the time spent programming is not typing but thinking, testing, debugging, etc. Doing the same calculation for BaseHTTPServer.py and SimpleHTTPServer.py in the standard library, I get 1.9% and 2.0% respectively. > This

Re: [Python-Dev] Python-3.0, unicode, and os.environ

2008-12-13 Thread Steven D'Aprano
> latin-1. For what it's worth, Konquorer 3.5 displays the two files as (1/2)(n+tilde).html (A+caret)(1/2)(A+tilde)(plusminus).html It doesn't seem to have any trouble opening either of them. -- Steven ___ Python-Dev mailing list Python

Re: [Python-Dev] extremely slow exit for program havin g huge (45G) dict (python 2.5.2)

2008-12-20 Thread Steven D'Aprano
ware. Even if this is a Will Not Fix, I'd be curious if anyone else can reproduce the problem. Hope this is helpful, Steven. > -Original Message- > From: python-dev-bounces+kristjan=ccpgames@python.org > [mailto:python-dev-bounces+kristjan=ccpgames@python.org] On >

Re: [Python-Dev] extremely slow exit for program having huge (45G) dict (python 2.5.2)

2008-12-22 Thread Steven D'Aprano
choose other mechanisms for speeding up the > exit process in various (less clean) ways, if they have a need for > this. > > BTW: Rather than using a huge in-memory dict, I'd suggest to either > use an on-disk dictionary such as the ones found in mxBeeBase or > a database. The

Re: [Python-Dev] extremely slow exit for program having huge (45G) dict (python 2.5.2)

2008-12-23 Thread Steven D'Aprano
On Sun, 21 Dec 2008 06:45:11 am Antoine Pitrou wrote: > Steven D'Aprano pearwood.info> writes: > > In November 2007, a similar problem was reported on the > > comp.lang.python newsgroup. 370MB was large enough to demonstrate > > the problem. I don't know if a

Re: [Python-Dev] A wart which should have been repaired in 3.0?

2008-12-26 Thread Steven D'Aprano
should be two different functions rather than one function with a switch. I think os.path.commonprefix should only operate on path components, and if character-by-character prefix matching on general strings is useful, then it should be a string method. -- Steven D'Aprano _

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Steven Bethard
On Mon, Jan 19, 2009 at 7:10 AM, Gerald Britton wrote: > PEP: 3142 > Title: Add a "while" clause to generator expressions [snip] > numbers in that range. Allowing for a "while" clause would allow > the redundant tests to be short-circuited: > > g = (n for n in range(100) while n*n < 50) >

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-20 Thread Steven D'Aprano
gladly give up that correspondence (which I don't find that great) in order to simplify exiting a generator expression early. So I like the proposed change. I find it elegant and very Pythonic. +1 for me. -- Steven D'Aprano ___ Pyth

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-21 Thread Steven D'Aprano
On Wed, 21 Jan 2009 03:10:24 pm Terry Reedy wrote: > Steven D'Aprano wrote: ... > > In a generator expression, we have: > > > > yielded-expr for-clause if-clause > > > > while the corresponding nested statements are: > > > > for-clause if

Re: [Python-Dev] PEP 374 (DVCS) now in reST

2009-01-23 Thread Steven Bethard
On Fri, Jan 23, 2009 at 12:06 PM, "Martin v. Löwis" wrote: >> import random >> print(random.choice('svn', 'bzr', 'hg', 'git')) > > Nice! So it's bzr, as my machine just told me (after adding > the square brackets). Wow, that decision was a lot easier than I thought it would be. ;-) Steve

Re: [Python-Dev] Additional behaviour for itertools.combinations

2009-01-25 Thread Steven D'Aprano
ot that difficult to create a generator to yield all the combinations: (comb for k in ks for comb in itertools.combinations(seq, k)) I'm with Nick that this would make a good example for the documentation. I don't object to combinations growing the extra functionality, but if it does, peo

Re: [Python-Dev] Python 3.0.1 (io-in-c)

2009-01-28 Thread Steven Bethard
On Wed, Jan 28, 2009 at 10:29 AM, "Martin v. Löwis" wrote: > Notice that the determination of the specific encoding used is fairly > elaborate: > - if IO is to a terminal, Python tries to determine the encoding of > the terminal. This is mostly relevant for Windows (which uses, > by default, the

Re: [Python-Dev] pprint(iterator)

2009-01-29 Thread Steven D'Aprano
nice if there was a standard way of spelling it. So I'm +0.5 on Aahz's suggestion of __pprint__. In my ideal world, __pprint__ should allow (but not require) extra arguments, so that one can do something like the following: pprint(binarytree) # sensible defaults pprint(binarytree,

Re: [Python-Dev] pprint(iterator)

2009-01-30 Thread Steven D'Aprano
Eric Smith wrote: Terry Reedy wrote: Ron Adam wrote: Steven D'Aprano wrote: Michael Foord wrote: Don't we have a pretty-print API - and isn't it spelled __str__ ? Not really. If it were as simple as calling str(obj), there would be no need for the pprint module. I agr

Re: [Python-Dev] Missing operator.call

2009-02-04 Thread Steven Bethard
On Wed, Feb 4, 2009 at 10:25 AM, Brett Cannon wrote: > On Wed, Feb 4, 2009 at 05:35, Hrvoje Niksic wrote: >> Andrew Bennetts wrote: >>> >>> A patch to add operator.caller(*args, **kwargs) may be a good idea. Your >>> example would then be: >>> >>>map(operator.caller(), lst) >> >> Regarding t

Re: [Python-Dev] Missing operator.call

2009-02-04 Thread Steven Bethard
On Wed, Feb 4, 2009 at 10:50 AM, Brett Cannon wrote: > On Wed, Feb 4, 2009 at 10:43, Steven Bethard wrote: >> Not sure I follow you here. It's not the __init__ that allows you to >> do ``x()``, it's the fact that the class declares a __call__, right? >> >>

Re: [Python-Dev] Partial function application 'from the right'

2009-02-05 Thread Steven D'Aprano
tring on commas, you can't say # Won't work when called: split_comma = partial(str.split, sep = ',') and to create a 'log to base 10' function, you can't say # Won't work when called: log_10 = partial(math.log, base = 10.0) becau

Re: [Python-Dev] FileSystemError or FilesystemError?

2011-08-23 Thread Steven D'Aprano
any dictionary or spell checker I've ever used). (Nor do we write filingsystem, governmentsystem, politicalsystem or schoolsystem. This is English, not German.) -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.o

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

2011-08-26 Thread Steven D'Aprano
as obsolete with little detailed discussion of the differences: http://docs.python.org/release/1.5/lib/node69.html#SECTION00530 -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyth

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

2011-08-26 Thread Steven D'Aprano
Ben Finney wrote: Steven D'Aprano writes: Ben Finney wrote: "M.-A. Lemburg" writes: No, you tell them: "If you want Unicode 6 semantics, use regex, if you're fine with Unicode 2.0/3.0 semantics, use re". What do we say, then, to those who are unaware of t

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

2011-08-26 Thread Steven D'Aprano
ld --be introduced without a corresponding future_statement. I wasn't around for the move from 1.4 regex to 1.5 re, so I don't know what was done poorly last time. But I can't see why we should treat regular expressions so differently from (sa

Re: [Python-Dev] PEP 393 Summer of Code Project

2011-08-27 Thread Steven D'Aprano
ry from a couple of timeit runs on short-ish lists. -- Steven ___ 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 move to replace re with regex?

2011-08-27 Thread Steven D'Aprano
. It may be an optional part for at least one release, but removing it again will require the same deprecation process as removing any other language feature (see PEP 5 for more details). -- Steven ___ Python-Dev mailing list Python-Dev@python

Re: [Python-Dev] PEP 393 Summer of Code Project

2011-09-01 Thread Steven D'Aprano
ipedia.org/wiki/Diacritic#Languages_with_letters_containing_diacritics -- Steven ___ 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] Maintenance burden of str.swapcase

2011-09-06 Thread Steven D'Aprano
k.title() 'Aaaa Bbbb' >>> k[0].swapcase()+k[1:].lower() 'Aaaa ' If k is uppercase, previous .upper() is redundant. If k is mixed case, code may have problems. "May" have problems? pERSONNALLY, i THINK THAT A SWAPCASE COMMAND IS ESSEN

Re: [Python-Dev] Maintenance burden of str.swapcase

2011-09-06 Thread Steven D'Aprano
org/pipermail/python-dev/2010-December/106650.html I can't exactly defend the existence of swapcase, it does seem to be a fairly specialised function. But given that it exists, I'm -0.5 on removal on the basis of "if it ain't broke, don't fix it". -- Steven

Re: [Python-Dev] range objects in 3.x

2011-09-23 Thread Steven D'Aprano
oint-range/ -- Steven ___ 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] range objects in 3.x

2011-09-23 Thread Steven D'Aprano
Guido van Rossum wrote: On Fri, Sep 23, 2011 at 6:36 PM, Steven D'Aprano wrote: Ethan Furman wrote: A question came up on StackOverflow about range objects and floating point numbers. I thought about writing an frange that did for floats what range does for ints, For what it&#x

Re: [Python-Dev] range objects in 3.x

2011-09-24 Thread Steven D'Aprano
Guido van Rossum wrote: On Fri, Sep 23, 2011 at 7:13 PM, Steven D'Aprano wrote: http://code.activestate.com/recipes/577068-floating-point-range/ I notice that your examples carefully skirt around the rounding issues. I also carefully *didn't* claim that it made rounding issues

Re: [Python-Dev] range objects in 3.x

2011-09-26 Thread Steven D'Aprano
-shedding: I don't like the name linspace. We've gone 20 years without a floating point range in Python. I think we should give people a bit of time to pay around with alternative APIs rather than just grab the first one that comes along. -- Steven

Re: [Python-Dev] range objects in 3.x

2011-09-27 Thread Steven D'Aprano
my second attempt, which offers both count/start/end and count/start/step APIs: http://code.activestate.com/recipes/577881-equally-spaced-floats-part-2/ -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/lis

Re: [Python-Dev] range objects in 3.x

2011-09-27 Thread Steven D'Aprano
that would be great, but I think that a daterange() function in the datetime module would be more appropriate. Who is going to think to import math if you want a range of dates? -- Steven ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] range objects in 3.x

2011-09-27 Thread Steven D'Aprano
into the round hole of integer counts. We should not try to force this float range to use the same API as builtin range. (In hindsight, it is a shame that range is called "range" instead of "count". itertools got the name right.) -- Steven _

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Steven D'Aprano
es is useful: "IOError is allowed, but any other exception is a bug." makes perfect sense. assertNotRaises doesn't seem sensible or useful to me: "IOError is a failed test, but any other exception is a bug." What's the point? When would you use that? -- Steven __

Re: [Python-Dev] New stringbench benchmark results

2011-10-06 Thread Steven D'Aprano
qual, and avoid making a potentially expensive copy? I note that if count is zero, the source string is returned unchanged: >>> t = s.replace('a', 'b', 0) >>> t is s True -- Steven ___ 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 (3.2): Issue #11956: Skip test_import.test_unwritable_directory on FreeBSD when run as

2011-10-06 Thread Steven D'Aprano
ng as root *badly*. [1] If not, that will come as a mighty big surprise to Red Hat, among others, who use Python for system tools run as root. -- Steven ___ 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] Disabling cyclic GC in timeit module

2011-10-07 Thread Steven D'Aprano
grow a macro-benchmark tool too? I find myself often using timeit to time macro-benchmarks simply because it's more convenient at the interactive interpreter than the alternatives. Something like this idea perhaps? http://preshing.com/20110924/timing-your-code-us

Re: [Python-Dev] Deprecation policy

2011-11-28 Thread Steven D'Aprano
minor releases. Unless there is a good reason to actively remove an API, it should stay as long as possible. "I don't like this and it should go" is not a good reason, nor is "but there's a better way you should use"

Re: [Python-Dev] [PATCH] Adding braces to __future__

2011-12-09 Thread Steven D'Aprano
Guido van Rossum wrote: Point of order (repeated), please move this thread to python-ideas. Isn't that cruel to the people reading python-ideas? -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/lis

Re: [Python-Dev] Tag trackbacks with version (was Re: readd u'' literal support in 3.3?)

2011-12-10 Thread Steven D'Aprano
er to use, I'm actively against it. Otherwise I'm just mildly "meh, why bother?". -- Steven ___ 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] Potential NULL pointer dereference in descrobject.c

2011-12-17 Thread Steven D'Aprano
stead of a box. Depending on the typeface, others might see a full box, an empty box, a diamond with a question mark in it, nothing at all, or some other glyph. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailma

Re: [Python-Dev] Potential NULL pointer dereference in descrobject.c

2011-12-17 Thread Steven D'Aprano
Steven D'Aprano wrote: Greg Ewing wrote: Matt Joiner wrote: ಠ_ಠ What's up with these ?_? messages? I think that, depending on the typeface you view it with, it is supposed to be some sort of smiley: two big wide open square eyes with tightly pursed lips. Presumably it is supp

Re: [Python-Dev] Hash collision security issue (now public)

2011-12-30 Thread Steven D'Aprano
then apps can choose their own by subclassing dict. Responsibility for doing the right thing falls onto the library author, rather than Python itself. Some people may consider that a minus. -- Steven ___ Python-Dev mailing list Python-Dev@python

Re: [Python-Dev] RNG in the core

2012-01-03 Thread Steven D'Aprano
may not have /dev/urandom, we need a PRNG in the core, too. I therefore propose to move the Mersenne twister from randommodule.c into the core, too. Mersenne twister is not suitable for cryptography. http://en.wikipedia.org/wiki/Mersenne_twister -- Steven _

Re: [Python-Dev] Hash collision security issue (now public)

2012-01-05 Thread Steven D'Aprano
of a flag in the sys module to verify the behaviour, I'd want to see for myself that hash collisions are no longer predictable. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/pyth

Re: [Python-Dev] Hash collision security issue (now public)

2012-01-05 Thread Steven D'Aprano
Benjamin Peterson wrote: 2012/1/5 Nick Coghlan : On Fri, Jan 6, 2012 at 10:07 AM, Steven D'Aprano wrote: Surely the way to verify the behaviour is to run this from the shell: python -c print(hash("abcde")) twice, and see that the calls return different values. (Or have I mi

Re: [Python-Dev] Hash collision security issue (now public)

2012-01-05 Thread Steven D'Aprano
Benjamin Peterson wrote: 2012/1/5 Steven D'Aprano : [...] There's nothing obscure about directly testing the hash. That's about as far from obscure as it is possible to get: you are directly testing the presence of a feature by testing the feature. It's obscure because h

Re: [Python-Dev] Hash collision security issue (now public)

2012-01-06 Thread Steven D'Aprano
Glenn Linderman wrote: On 1/5/2012 5:52 PM, Steven D'Aprano wrote: At some point, presuming that there is no speed penalty, the behaviour will surely become not just enabled by default but mandatory. Python has never promised that hashes must be predictable or consistent, so apart

Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-09 Thread Steven D'Aprano
Victor Stinner wrote: -if os.name in ('nt', 'os2'): +if os.name in ('nt'): This change is wrong: it should be os.name == 'nt'. Or possibly os.name in ('nt', ) (note the comma). -- Steven

Re: [Python-Dev] Status of the fix for the hash collision vulnerability

2012-01-13 Thread Steven D'Aprano
as much of an improvement. +1 on random seeding. Default to on in 3.3+ and default to off in older versions, which allows people to avoid breaking their code until they're ready for it to be broken. -- Steven ___ Python-Dev mailing list Python-Dev@p

Re: [Python-Dev] Status of the fix for the hash collision vulnerability

2012-01-14 Thread Steven D'Aprano
. Given that developers are unlikely to ever see 1000 collisions by accident, or even realise that it could happen, I don't expect that many people will do that -- until they personally get bitten. -- Steven ___ Python-Dev mailing list Pytho

Re: [Python-Dev] Status of the fix for the hash collision vulnerability

2012-01-14 Thread Steven D'Aprano
east one library (or so I'm told): http://mail.python.org/pipermail/python-list/2012-January/1286535.html -- Steven ___ 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] Python-Dev Digest, Vol 102, Issue 35

2012-01-16 Thread Steven D'Aprano
python wrote: jbk [snip 560+ lines of quoted text] Please delete irrelevant text when replying to digests, and replace the subject line with a meaningful subject. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org

Re: [Python-Dev] PEP 407: New release cycle and introducing long-term support versions

2012-01-18 Thread Steven D'Aprano
person will decrease even as the total work load increases. I don't think that's a safe bet. -- Steven ___ 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 407 / splitting the stdlib

2012-01-18 Thread Steven D'Aprano
experience they have with Python. -- Steven ___ 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] Counting collisions for the win

2012-01-19 Thread Steven D'Aprano
nt over the application hanging indefinitely, but I'd hardly call it a fix. Ruby uses randomized hashes. Are there any other languages with a dict or mapping class that raises on too many exceptions? -- Steven ___ Python-Dev mailing list Python

Re: [Python-Dev] exception chaining

2012-01-20 Thread Steven D'Aprano
ing HamError as a SpamError instead. (It's not actually a re-raise as the traceback will point to a different line of code, but it's close enough.) I'd prefer "raise SpamError from None", but I understand that this ca

Re: [Python-Dev] Counting collisions for the win

2012-01-20 Thread Steven D'Aprano
yError for "you have reached a limit on collisions"? It has nothing to do with memory. Using MemoryError for something which isn't a memory error is ugly. How about RuntimeError? -- Steven ___ Python-Dev mailing list Python-Dev@pyt

Re: [Python-Dev] Counting collisions for the win

2012-01-20 Thread Steven D'Aprano
MAXCOLLISIONS either be configureable or just choose a random count between M and N, say 700 and 999. Have I missed something? Why wouldn't the attacker simply target 1000 collisions, and if the collision triggers at 700 instead of 1000, that's a bonus?

Re: [Python-Dev] Counting collisions for the win

2012-01-20 Thread Steven D'Aprano
Guido van Rossum wrote: It should derive from BaseException. RuntimeError meets that requirement, and it is an existing exception so there are no issues with introducing a new built-in exception to a point release. py> issubclass(RuntimeError, BaseException) True -- Ste

Re: [Python-Dev] exception chaining

2012-01-20 Thread Steven D'Aprano
Ethan Furman wrote: The question I have at the moment is: should `raise as` be an error if no exception is currently being handled? I think so. "raise as Spam" essentially means "raise Spam with the context set to None". That's actually only useful if the context otherwise wouldn't be None,

Re: [Python-Dev] Counting collisions for the win

2012-01-21 Thread Steven D'Aprano
time it is used, otherwise the pseudorandom number generator using it just returns the same value each time. Should we be talking about a salt rather than a seed? -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailma

Re: [Python-Dev] PEP 408 -- Standard library __preview__ package

2012-01-27 Thread Steven D'Aprano
__preview__ does not constitute acceptance of its API". (On the other hand, if __preview__ becomes used in the future for library authors to fob-off criticism for 18 months in the hope it will just be forgotten, then this will be a bad thing.) -- Steven ___

Re: [Python-Dev] PEP 408 -- Standard library __preview__ package

2012-01-27 Thread Steven D'Aprano
may have subtle, or major, API differences, how do you use it? try: result = thing.foo(a, b, c) + thing.bar(x) except AttributeError: # Must be the preview version result = thing.foobar(a, c, b, x) -- Steven ___ Python-Dev mailing list

Re: [Python-Dev] PEP for allowing 'raise NewException from None'

2012-01-27 Thread Steven D'Aprano
only slightly better. Speaking for everyone that wants context suppression (using Steven D'Aprano's words): chained exceptions expose details to the caller that are irrelevant implementation details. Especially if the users are non-programmer app users. Or beginner programmers, e

Re: [Python-Dev] plugging the hash attack

2012-01-27 Thread Steven D'Aprano
n the hash stability. Do you have the expectation that it will become on by default in some future release? -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 408 -- Standard library __preview__ package

2012-01-27 Thread Steven D'Aprano
Michael Foord wrote: On 27/01/2012 20:48, Steven D'Aprano wrote: Eli Bendersky wrote: try: from __preview__ import thing except ImportError: import thing So no need to target a very specific version of Python. Yep, this is what I had in mind. And it appeared too trivial to pla

Re: [Python-Dev] A new dictionary implementation

2012-01-29 Thread Steven D'Aprano
= 1 b.ham = 2 how can a.__dict__ and b.__dict__ share key arrays? I've tried reading the source, but I'm afraid I don't understand it well enough to make sense of it. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://

Re: [Python-Dev] PEP 408 -- Standard library __preview__ package

2012-02-03 Thread Steven D'Aprano
ave to read the docs to find out they're preview. -- Steven ___ 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 408 -- Standard library __preview__ package

2012-02-04 Thread Steven D'Aprano
Terry Reedy wrote: On 2/3/2012 6:18 PM, Steven D'Aprano wrote: Now we're talking about having to add __preview__ into that mix too? As I understand it, Guido nixed that idea. (Or did I imagine that?) No, you are right, discussion should cease. It is already marked 'rejec

Re: [Python-Dev] PEP 408 -- Standard library __preview__ package

2012-02-05 Thread Steven D'Aprano
Paul Moore wrote: On 4 February 2012 11:25, Steven D'Aprano wrote: It strikes me that it would be helpful sometimes to programmatically recognise "preview" modules in the std lib. Could we have a recommendation in PEP 8 that such modules should have a global variable called P

Re: [Python-Dev] Add a new "locale" codec?

2012-02-08 Thread Steven D'Aprano
ses the global context by default, while this will use the global locale encoding only if you explicitly tell it to. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://ma

Re: [Python-Dev] folding cElementTree behind ElementTree in 3.3

2012-02-08 Thread Steven D'Aprano
last-ditch attempt would include trying to call him by phone, sending him a dead-tree letter by post, and if important enough, actually driving out to his home or place of work and trying to see him face to face. (All depending on the importance of making contac

Re: [Python-Dev] PEP 411: Provisional packages in the Python standard library

2012-02-10 Thread Steven D'Aprano
within Python itself. +1 -- Steven ___ 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

<    11   12   13   14   15   16   17   18   19   20   >