Re: [Python-Dev] cpython (3.2): don't mention implementation detail

2011-12-20 Thread Xavier Morel
On 2011-12-20, at 11:08 , Antoine Pitrou wrote: > But that's basically the only reason to invoke the > `operator.attrgetter("foo")` ugliness, instead of writing the explicit > and obvious `lambda x: x.foo`. I don't agree with this, an attrgetter in the current namespace can be clearer than an expl

Re: [Python-Dev] Python as a Metro-style App

2012-01-07 Thread Xavier Morel
On 2012-01-08, at 01:27 , Antoine Pitrou wrote: >>> When you say MoveFile is absent, is MoveFileEx supported instead? >> WinRT strongly prefers asynchronous methods for all lengthy >> operations. The most likely call to use for moving files is >> StorageFile.MoveAsync. >> http://msdn.microsoft.co

Re: [Python-Dev] Backwards incompatible sys.stdout.write() behavior in Python 3 (Was: [Python-ideas] Pythonic buffering in Py3 print())

2012-01-13 Thread Xavier Morel
On 2012-01-13, at 16:34 , anatoly techtonik wrote: > Posting to python-dev as it is no more relates to the idea of improving > print(). > > > sys.stdout.write() in Python 3 causes backwards incompatible behavior that > breaks recipe for unbuffered character reading from stdin on Linux - > http://

Re: [Python-Dev] Backwards incompatible sys.stdout.write() behavior in Python 3 (Was: [Python-ideas] Pythonic buffering in Py3 print())

2012-01-13 Thread Xavier Morel
On 2012-01-13, at 17:19 , Antoine Pitrou wrote: > > "-u" forces line-buffering mode for stdout/stderr, which is already the > default if they are wired to an interactive device (isattr() returning > True). Oh, I had not noticed the documentation had changed in Python 3 (in Python 2 it stated that

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

2012-02-14 Thread Xavier Morel
On 2012-02-14, at 08:58 , Stefan Behnel wrote: > > These days, other Python implementations already provide the cElementTree > module as a bare alias for ElementTree.py anyway, without emitting any > warnings. Why should CPython be the only one that shouts at users for > importing it? Since all w

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

2012-02-20 Thread Xavier Morel
On 2012-02-20, at 12:36 , Eli Bendersky wrote: > On Mon, Feb 20, 2012 at 01:12, "Martin v. Löwis" wrote: > >>> The change of backing ElementTree by cElementTree has already been >>> implemented in the default branch (3.3) by Florent Xicluna with careful >>> review from me and others. etree has an

Re: [Python-Dev] hash randomization in 3.3

2012-02-21 Thread Xavier Morel
On 2012-02-21, at 21:24 , Brett Cannon wrote: > On Tue, Feb 21, 2012 at 15:05, Barry Warsaw wrote: > >> On Feb 21, 2012, at 02:58 PM, Benjamin Peterson wrote: >> >>> 2012/2/21 Antoine Pitrou : Hello, Shouldn't it be enabled by default in 3.3? >> >> Yes. >> >>> Should you

Re: [Python-Dev] Add a frozendict builtin type

2012-02-27 Thread Xavier Morel
On 2012-02-27, at 19:53 , Victor Stinner wrote: > Rationale > = > > A frozendict type is a common request from users and there are various > implementations. There are two main Python implementations: > > * "blacklist": frozendict inheriting from dict and overriding methods > to raise a

Re: [Python-Dev] c/ElementTree XML serialisation

2012-05-08 Thread Xavier Morel
On 2012-05-09, at 01:41 , Alex Leach wrote: > > True. I might not need the CDATA tag to wrap the javascript then, but I still > need < and > symbols. I have no idea how to write a loop in javascript > without > one. Erm… you have them? What do you think `<` and `>` are? As to writing a loop

Re: [Python-Dev] Possible rough edges in Python 3 metaclasses (was Re: Language reference updated for metaclasses)

2012-06-05 Thread Xavier Morel
On 5 juin 2012, at 14:24, Nick Coghlan wrote: > On Tue, Jun 5, 2012 at 8:25 PM, Nick Coghlan wrote: >> On Tue, Jun 5, 2012 at 7:11 PM, Michael Foord >> wrote: >>> >>> On 5 Jun 2012, at 08:53, Nick Coghlan wrote: >>> [snip...] Now, one minor annoyance with current class decora

Re: [Python-Dev] backporting stdlib 2.7.x from pypy to cpython

2012-06-10 Thread Xavier Morel
On 2012-06-08, at 20:29 , Brett Cannon wrote: > On Fri, Jun 8, 2012 at 2:21 PM, fwierzbi...@gmail.com > wrote: > >> On Fri, Jun 8, 2012 at 10:59 AM, Brett Cannon wrote: >>> R. David already replied to this, but just to reiterate: tests can always >>> get updated, and code that fixes a bug (and l

Re: [Python-Dev] Introduction

2012-08-02 Thread Xavier Morel
On 2012-08-02, at 09:28 , Shanth Kumar wrote: > Hi I am Shanthkumar from Bangalore, India, working for a software firm. > Good to see the mailing group, as i am new to python curious to ask you > people couple of queireis. I fear that is very likely the wrong mailing list for that: python-dev is

Re: [Python-Dev] 3.3 str timings

2012-08-21 Thread Xavier Morel
On 21 août 2012, at 19:25, Steven D'Aprano wrote: > On 21/08/12 23:04, Victor Stinner wrote: > >> I don't like the timeit module for micro benchmarks, it is really >> unstable (default settings are not written for micro benchmarks). > [...] >> I wrote my own benchmark tool, based on timeit, to ha

Re: [Python-Dev] Stdlib and timezones, again

2012-09-30 Thread Xavier Morel
On 2012-09-30, at 15:15 , Antoine Pitrou wrote: > On Sun, 30 Sep 2012 15:10:06 +0200 > Dirkjan Ochtman wrote: >> On Sun, Sep 30, 2012 at 3:03 PM, Antoine Pitrou wrote: >>> Can't we simply include the Olson database in Windows installers? >> >> We probably can, but the problem is that it's updat

Re: [Python-Dev] Stdlib and timezones, again

2012-10-01 Thread Xavier Morel
On 2012-10-01, at 17:32 , Terry Reedy wrote: > On 10/1/2012 10:06 AM, Lennart Regebro wrote: > >> Actually, that's not a bad idea. My original idea was to warn if it >> *was* outdated, but since there is no way to check that, I scratched >> that idea. > > Is there really no way to get a 'last up

Re: [Python-Dev] [BUG] Trailing spaces in pretty-printed JSON

2012-10-13 Thread Xavier Morel
On 2012-10-13, at 08:40 , Leo wrote: > Use this script on a json file and observe all the trailing spaces > generated. (screenshot attached.) 1. Why didn't you report that on the tracker? 2. Why are you rewriting json.tool? ___ Python-Dev mailing list P

Re: [Python-Dev] Sign of bytes

2012-10-31 Thread Xavier Morel
On 2012-10-31, at 18:44 , anatoly techtonik wrote: > I wonder why Python uses signed chars for bytes > http://docs.python.org/2/library/ctypes.html#ctypes.c_byte That's not Python, that's ctypes. struct[0] has no "bytes" it uses "char" for everything. If I had to guess, it would be because "char"

Re: [Python-Dev] ctypes is not an acceptable implementation strategy for modules in the standard library?

2012-11-05 Thread Xavier Morel
On 2012-11-05, at 10:32 , Ronald Oussoren wrote: >> My arguments for ctypes: >> 1. doesn't require compilation >> 2. easier to maintain (no C/toolchain knowledge/ownership needed) >> 3. pure Python is impossible to exploit (unlike pure C) > > That's not not quite true, python code that uses ctypes

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Xavier Morel
On 2012-11-14, at 17:42 , Richard Oudkerk wrote: > On 14/11/2012 4:23pm, Serhiy Storchaka wrote: >> PEP 8 recommends: >> >> a_dict = dict( >> x=1, >> y=2, >> z=3, >> ... >> ) >> >> and >> >> a_dict = { >> 'x': 1, >> 'y': 2, >> 'z': 3, >> ... >> } > > In which s

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Xavier Morel
On 2012-11-14, at 18:08 , Mark Adam wrote: > > That's not a recommendation to use the **kwargs style. And nobody said it was. It's a recommendation to not put spaces around the equals sign when using keyword arguments which is the correction Serhiy applied to the original code (along with adding

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Xavier Morel
On 2012-11-14, at 18:10 , Mark Adam wrote: > > Try the canonical {'x':1}. Only dict allows the special > initialization above. Other collections require an iterable. Other collections don't have a choice, because it would often be ambiguous. Dicts do not have that issue. > I'm guessing > **kw

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Xavier Morel
On 2012-11-14, at 19:54 , Mark Adam wrote: > > Merging of two dicts is done with dict.update. No, dict.update merges one dict (or two) into a third one. > How do you do it on > initialization? This doesn't make sense. dict(d1, **d2) ___ Python-Dev ma

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Xavier Morel
On 2012-11-14, at 21:53 , Mark Adam wrote: > On Wed, Nov 14, 2012 at 1:37 PM, Xavier Morel wrote: >> On 2012-11-14, at 19:54 , Mark Adam wrote: >>> >>> Merging of two dicts is done with dict.update. >> >> No, dict.update merges one dict (or two) into a t

Re: [Python-Dev] performance of {} versus dict(), de fmd(**kw): return kw trumps all ; -)

2012-11-14 Thread Xavier Morel
On 2012-11-14, at 23:43 , Chris Withers wrote: > On 14/11/2012 22:37, Chris Withers wrote: >> On 14/11/2012 10:11, mar...@v.loewis.de wrote: >>> def xdict(**kwds): >>> return kwds >> >> Hah, good call, this trumps both of the other options: >> >> $ python2.7 -m timeit -n 100 -r 5 -v >> "{

Re: [Python-Dev] logging and rotation

2012-11-25 Thread Xavier Morel
On 2012-11-25, at 18:02 , Oleg Broytman wrote: > On Sun, Nov 25, 2012 at 01:14:11PM +0100, Matthias Bernt > wrote: >> I'm using the logging module and write my log messages via the FileHandler. >> I just realized that using an external log rotation mechanism does not >> work. That is, new message

Re: [Python-Dev] type vs. class terminology

2012-11-25 Thread Xavier Morel
On 2012-11-26, at 07:54 , Nick Coghlan wrote: > On Mon, Nov 26, 2012 at 3:01 PM, Chris Jerdonek > wrote: > >> I would like to know when we should use "class" in the Python 3 >> documentation, and when we should use "type." Are these terms >> synonymous in Python 3, and do we have a preference

Re: [Python-Dev] Emacs users: hg-tools-grep

2012-12-12 Thread Xavier Morel
On 2012-12-12, at 15:12 , Ross Lagerwall wrote: > On Wed, Dec 12, 2012 at 01:27:21PM +0200, Petri Lehtinen wrote: >> Brandon W Maister wrote: >>> (defconst git-tools-grep-command >>> "git ls-files -z | xargs -0 grep -In %s" >>> "The command used for grepping files using git. See `git-tools-grep'

Re: [Python-Dev] why do we allow this syntax?

2013-02-08 Thread Xavier Morel
On 2013-02-08, at 16:39 , Chris Withers wrote: > Hi All, > > Just had a bit of an embarrassing incident in some code where I did: > > sometotal =+ somevalue > > I'm curious why this syntax is allowed? I'm sure there are good reasons, but > thought I'd ask… sometotal = (expression) is valid s

Re: [Python-Dev] why do we allow this syntax?

2013-02-08 Thread Xavier Morel
On 2013-02-08, at 18:45 , Chris Withers wrote: > On 08/02/2013 16:17, Oscar Benjamin wrote: >> Decimal.__pos__ uses it to return a Decimal instance that has the >> default precision of the current Decimal context: >> > from decimal import Decimal > d = Decimal('0.3

Re: [Python-Dev] Usage of += on strings in loops in stdlib

2013-02-12 Thread Xavier Morel
On 2013-02-12, at 22:40 , Ned Batchelder wrote: > But the only reason "".join() is a Python idiom in the first place is because > it was "the fast way" to do what everyone initially coded as "s += ...". > Just because we all learned a long time ago that joining was the fast way to > build a st

Re: [Python-Dev] Usage of += on strings in loops in stdlib

2013-02-13 Thread Xavier Morel
On 2013-02-13, at 12:37 , Steven D'Aprano wrote: > ># even less obvious than sum >map(operator.add, array) That one does not work, it'll try to call the binary `add` with each item of the array when the map iterator is reified, erroring out. functools.reduce(operator.add, array, '')

Re: [Python-Dev] Marking GC details as CPython-only

2013-02-13 Thread Xavier Morel
On 2013-02-13, at 19:48 , Maciej Fijalkowski wrote: > Hi > > I've tried (and failed) to find what GC details (especially finalizer > semantics) are CPython only and which ones are not. The best I could > find was the documentation of __del__ here: > http://docs.python.org/2/reference/datamodel.ht

<    1   2