Re: [Python-Dev] Why does IOBase.__del__ call .close?

2014-06-10 Thread Antoine Pitrou
Le 10/06/2014 21:30, Nikolaus Rath a écrit : For me, having __del__ call close() does not qualify as a reasonable default implementation unless close() is required to be idempotent (which one could deduce from the documentation if one tries to, but it's far from clear). close() should indeed b

Re: [Python-Dev] Why does IOBase.__del__ call .close?

2014-06-10 Thread MRAB
On 2014-06-11 02:30, Nikolaus Rath wrote: Hello, I recently noticed (after some rather protacted debugging) that the io.IOBase class comes with a destructor that calls self.close(): [0] nikratio@vostro:~/tmp$ cat test.py import io class Foo(io.IOBase): def close(self): print('clos

[Python-Dev] Why does IOBase.__del__ call .close?

2014-06-10 Thread Nikolaus Rath
Hello, I recently noticed (after some rather protacted debugging) that the io.IOBase class comes with a destructor that calls self.close(): [0] nikratio@vostro:~/tmp$ cat test.py import io class Foo(io.IOBase): def close(self): print('close called') r = Foo() del r [0] nikratio@vostro

Re: [Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Thomas Wouters
On Tue, Jun 10, 2014 at 9:30 AM, Steve Dower wrote: > > I ran a quick test with profile-guided optimization (PGO, pronounced > "pogo"), which has supposedly been improved since VC9, and saw a very > unscientific 20% speed improvement on pybench.py and 10% size reduction in > python35.dll. I'm not

Re: [Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Steve Dower
Martin v. Löwis wrote: > Am 10.06.14 18:30, schrieb Steve Dower: >> I ran a quick test with profile-guided optimization (PGO, pronounced >> "pogo"), which has supposedly been improved since VC9, and saw a very >> unscientific 20% speed improvement on pybench.py and 10% size >> reduction in python35

Re: [Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Martin v. Löwis
Am 10.06.14 18:30, schrieb Steve Dower: > I ran a quick test with profile-guided optimization (PGO, pronounced > "pogo"), which has supposedly been improved since VC9, and saw a very > unscientific 20% speed improvement on pybench.py and 10% size > reduction in python35.dll. I'm not sure what we us

Re: [Python-Dev] Moving Python 3.5 on Windows to a new compiler

2014-06-10 Thread Martin v. Löwis
Am 07.06.14 17:38, schrieb Steve Dower: > One more possible concern that I just thought of is the availability of > the build tools on Windows Vista and Windows 7 RTM (that is, without > SP1). I'd have to check, but I don't believe anything after VS 2012 is > supported on Vista and it's entirely po

Re: [Python-Dev] Moving Python 3.5 on Windows to a new compiler

2014-06-10 Thread Martin v. Löwis
Am 07.06.14 01:01, schrieb Steve Dower: > We keep the VS 2010 files around and make sure they keep working. > This is the biggest risk of the whole plan, but I believe that > there's enough of a gap between when VS 14 is planned to release > (which I know, but can't share) and when Python 3.5 is pl

Re: [Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Victor Stinner
2014-06-10 18:30 GMT+02:00 Steve Dower : > I ran a quick test with profile-guided optimization (PGO, pronounced "pogo"), > which has supposedly been improved since VC9, and saw a very unscientific 20% > speed improvement on pybench.py and 10% size reduction in python35.dll. I'm > not sure what w

Re: [Python-Dev] Documentation Oversight

2014-06-10 Thread Terry Reedy
On 6/10/2014 2:51 PM, Hasan Diwan wrote: From the csv module pydoc: "The optional "dialect" parameter is discussed below" The discussion is actually above the method. Present in 2.7.6. Bug reports should be posted on the tracker rather than sent here. Short doc reports like this can be sent

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Zachary Ware
On Tue, Jun 10, 2014 at 2:04 PM, Ben Hoyt wrote: >>> To solve this problem, what do people think about adding an >>> "st_winattrs" attribute to the object returned by os.stat() on >>> Windows? >> >> +1 to the idea, whatever the exact implementation. > > Cool. > > I think we should add a st_winattr

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Ben Hoyt
>> To solve this problem, what do people think about adding an >> "st_winattrs" attribute to the object returned by os.stat() on >> Windows? > > +1 to the idea, whatever the exact implementation. Cool. I think we should add a st_winattrs integer attribute (on Windows) and then also add the FILE_A

[Python-Dev] Documentation Oversight

2014-06-10 Thread Hasan Diwan
>From the csv module pydoc: "The optional "dialect" parameter is discussed below" The discussion is actually above the method. Present in 2.7.6. -- H -- Sent from my mobile device Envoyé de mon portable ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Steve Dower
> Antoine Pitrou wrote: > Le 10/06/2014 12:30, Steve Dower a écrit : >> >> I ran a quick test with profile-guided optimization (PGO, pronounced >> "pogo"), which has supposedly been improved since VC9, and saw a very >> unscientific 20% speed improvement on pybench.py and 10% size reduction in >> p

Re: [Python-Dev] namedtuple implementation grumble

2014-06-10 Thread Eric V. Smith
>> I wonder how a hybrid approach would work? Use a dynamically-created >> class, but then construct the __new__ method using exec and inject it >> into the new class. As far as I can see, it's only __new__ that benefits >> from the exec approach. >> >> Anyone tried this yet? Is it worth an expe

Re: [Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Antoine Pitrou
Le 10/06/2014 12:30, Steve Dower a écrit : I ran a quick test with profile-guided optimization (PGO, pronounced "pogo"), which has supposedly been improved since VC9, and saw a very unscientific 20% speed improvement on pybench.py and 10% size reduction in python35.dll. I'm not sure what we use

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Zachary Ware
On Tue, Jun 10, 2014 at 12:17 PM, Ethan Furman wrote: > On 06/09/2014 09:02 PM, Ben Hoyt wrote: >> To solve this problem, what do people think about adding an >> "st_winattrs" attribute to the object returned by os.stat() on >> Windows? > > > +1 to the idea, whatever the exact implementation. Agr

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Ethan Furman
On 06/09/2014 09:02 PM, Ben Hoyt wrote: To solve this problem, what do people think about adding an "st_winattrs" attribute to the object returned by os.stat() on Windows? +1 to the idea, whatever the exact implementation. -- ~Ethan~ ___ Python-Dev

[Python-Dev] Python 3.5 on VC14 - update

2014-06-10 Thread Steve Dower
For anyone who is interested in more details on the CRT changes, there's a blog post from my colleague who worked on most of them at http://blogs.msdn.com/b/vcblog/archive/2014/06/10/the-great-crt-refactoring.aspx I wanted to call out one section and add some details: In order to unify thes

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Paul Moore
On 10 June 2014 13:58, Ben Hoyt wrote: > So stat.FILE_ATTRIBUTES_HIDDEN and the like? Yep. (Maybe WIN_FILE_ATTRIBUTES_HIDDEN, but the Unix ones don't have an OA name prefix, so I'd go with your original). Paul ___ Python-Dev mailing list Python-Dev@pyt

Re: [Python-Dev] Criticism of execfile() removal in Python3

2014-06-10 Thread Nick Coghlan
On 10 June 2014 23:05, R. David Murray wrote: > On Tue, 10 Jun 2014 19:07:40 +1000, Nick Coghlan wrote: >> I believe it's a space/speed trade-off, so I'd be surprised if it made >> sense for CPython in general. There are also some behavioural differences >> when it comes to handling syntax errors

Re: [Python-Dev] Criticism of execfile() removal in Python3

2014-06-10 Thread R. David Murray
On Tue, 10 Jun 2014 19:07:40 +1000, Nick Coghlan wrote: > On 10 Jun 2014 18:41, "Paul Moore" wrote: > > > > On 10 June 2014 08:36, Nick Coghlan wrote: > > > The standard implementation of run_path reads the whole file into > > > memory, but MicroPython would be free to optimise that and do > > >

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Ben Hoyt
> The stat module exposes a load of constants - why not add the > (currently known) ones there? Finding the values of Windows constants > if you don't have access to the C headers can be a pain, so having > them defined *somewhere* as named values is useful. So stat.FILE_ATTRIBUTES_HIDDEN and the

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Paul Moore
On 10 June 2014 13:19, Ben Hoyt wrote: > Because these are fixed-forever constants, I suspect in library code > and the like people would just KISS and use an integer literal and a > comment, avoiding the import/constant thing: The stat module exposes a load of constants - why not add the (curren

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Ben Hoyt
>> if hasattr(st, 'st_winattrs') and st.st_winattrs & >> FILE_ATTRIBUTE_HIDDEN: > > That could be written more succinctly as: > > if getattr(st, 'st_winattrs', 0) & FILE_ATTRIBUTE_HIDDEN: > >> return True >> return False Yes, good call. Or one further: return getattr(

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Ben Hoyt
> > FILE_ATTRIBUTE_HIDDEN = 2 # constant defined in Windows.h > > > > if hasattr(st, 'st_winattrs') and st.st_winattrs & > > FILE_ATTRIBUTE_HIDDEN: > > I don't like such API, it requires to import constants, use masks, etc. > > I would prefer something like: > >if st.win_hidden: ... > > O

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread MRAB
On 2014-06-10 05:02, Ben Hoyt wrote: [snip] FILE_ATTRIBUTE_HIDDEN = 2 # constant defined in Windows.h def is_hidden(path): if startswith(os.path.basename(path), '.'): return True st = os.stat(path) if hasattr(st, 'st_winattrs') and st.st_winattrs & FILE_ATTRIBUTE_HIDDEN

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Victor Stinner
2014-06-10 6:02 GMT+02:00 Ben Hoyt : > To solve this problem, what do people think about adding an > "st_winattrs" attribute to the object returned by os.stat() on > Windows? > (...) > FILE_ATTRIBUTE_HIDDEN = 2 # constant defined in Windows.h > > if hasattr(st, 'st_winattrs') and st.st_winattr

Re: [Python-Dev] Criticism of execfile() removal in Python3

2014-06-10 Thread Nick Coghlan
On 10 Jun 2014 18:41, "Paul Moore" wrote: > > On 10 June 2014 08:36, Nick Coghlan wrote: > > The standard implementation of run_path reads the whole file into > > memory, but MicroPython would be free to optimise that and do > > statement by statement execution instead (while that will pose some

Re: [Python-Dev] Criticism of execfile() removal in Python3

2014-06-10 Thread Paul Moore
On 10 June 2014 08:36, Nick Coghlan wrote: > The standard implementation of run_path reads the whole file into > memory, but MicroPython would be free to optimise that and do > statement by statement execution instead (while that will pose some > challenges in terms of handling encoding cookies, f

Re: [Python-Dev] Returning Windows file attribute information via os.stat()

2014-06-10 Thread Paul Moore
On 10 June 2014 05:02, Ben Hoyt wrote: > To solve this problem, what do people think about adding an > "st_winattrs" attribute to the object returned by os.stat() on > Windows? +1. Given the precedent of Linux- and OS X-specific attributes, this seems like a no-brainer to me. Paul __

Re: [Python-Dev] Criticism of execfile() removal in Python3

2014-06-10 Thread Nick Coghlan
On 10 June 2014 12:23, Paul Sokolovsky wrote: > 1. It hampers interactive mode - instead of short and easy to type > execfile("file.py") one needs to use exec(open("file.py").read()). I'm > sure that's not going to bother a lot of people - after all, the > easiest way to execute a Python file is t