Re: [Python-Dev] Improving docs for len() of set

2016-02-08 Thread Lorenzo Moriondo
@Ben I am not either a great fan of formal (mathematic) definitions (: Lorenzo Moriondo, from mobile ~~it.linkedin.com~in~lorenzomoriondo~~ On Feb 8, 2016 5:38 PM, "Ethan Furman" wrote: > > On 02/08/2016 08:23 AM, Ben Hoyt wrote: > > > .. describe:: len(s) > > > >

Re: [Python-Dev] Improving docs for len() of set

2016-02-08 Thread Andrew Barnert via Python-Dev
On Monday, February 8, 2016 8:23 AM, Ben Hoyt wrote: >Just a suggestion for a documentation tweak. Currently the docs for len() on a >set say this: > > .. describe:: len(s)> > Return the cardinality of set *s*. > >I'm a relatively seasoned programmer, but I don't

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Matthias Bussonnier
> On Feb 8, 2016, at 06:40, Victor Stinner wrote: > > 2016-02-08 15:32 GMT+01:00 Victor Stinner : >> Since 3.3, functions of the os module started to emit >> DeprecationWarning when called with bytes filenames. >> (...) >> Recently, an user

Re: [Python-Dev] Improving docs for len() of set

2016-02-08 Thread Ethan Furman
On 02/08/2016 08:49 AM, Andrew Barnert via Python-Dev wrote: > +{{}} > > (using the normal von Neumann definitions for 0={} and > Succ(n) = n U {n}) I'm glad you know what you meant, 'cause I haven't got a clue! :) -- ~Ethan~ ___ Python-Dev mailing

[Python-Dev] Improving docs for len() of set

2016-02-08 Thread Ben Hoyt
Hi folks, Just a suggestion for a documentation tweak. Currently the docs for len() on a set say this: .. describe:: len(s) Return the cardinality of set *s*. I'm a relatively seasoned programmer, but I don't really have a maths background, and I didn't know what "cardinality" meant.

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Brett Cannon
On Mon, 8 Feb 2016 at 06:33 Victor Stinner wrote: > Hi, > > Since 3.3, functions of the os module started to emit > DeprecationWarning when called with bytes filenames. > > The rationale is quite simple: Windows native type for filenames is > Unicode, and the Windows

Re: [Python-Dev] Improving docs for len() of set

2016-02-08 Thread Ethan Furman
On 02/08/2016 08:23 AM, Ben Hoyt wrote: > .. describe:: len(s) > >Return the number of elements in set *s* (cardinality of *s*). Return the number of elements (cardinality) of *s*. +1 -- ~Ethan~ ___ Python-Dev mailing list

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread John Mark Vandenberg
On Tue, Feb 9, 2016 at 7:34 AM, Guido van Rossum wrote: > On Mon, Feb 8, 2016 at 11:51 AM, Victor Stinner > wrote: >> Le 8 févr. 2016 8:14 PM, "Guido van Rossum" a écrit : >>> Hum. I'm not excited by this idea. It is not bad syntax.

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Chris Angelico
On Tue, Feb 9, 2016 at 12:41 PM, MRAB wrote: > On 2016-02-09 00:53, Guido van Rossum wrote: >> >> The warning for 'assert (cond, msg)' was specifically put in because >> this is a nasty trap. It's *always* a mistaken attempt to write >> 'assert cond, msg' -- usually in

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Guido van Rossum
On Mon, Feb 8, 2016 at 5:41 PM, MRAB wrote: > On 2016-02-09 00:53, Guido van Rossum wrote: >> >> The warning for 'assert (cond, msg)' was specifically put in because >> this is a nasty trap. It's *always* a mistaken attempt to write >> 'assert cond, msg' -- usually in

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread MRAB
On 2016-02-09 00:53, Guido van Rossum wrote: The warning for 'assert (cond, msg)' was specifically put in because this is a nasty trap. It's *always* a mistaken attempt to write 'assert cond, msg' -- usually in an attempt to break a long line without using a backslash. I'd actually consider

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Guido van Rossum
Personally I don't think it's worth the churn. On Mon, Feb 8, 2016 at 5:49 PM, Chris Angelico wrote: > On Tue, Feb 9, 2016 at 12:41 PM, MRAB wrote: >> On 2016-02-09 00:53, Guido van Rossum wrote: >>> >>> The warning for 'assert (cond, msg)' was

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Chris Barker - NOAA Federal
All I can say is "ouch". Hard to call it a regression to no longer allow this mess... CHB > On Feb 8, 2016, at 4:37 PM, eryk sun wrote: > >> On Mon, Feb 8, 2016 at 2:41 PM, Chris Barker wrote: >> Just to clarify -- what does it currently do for bytes?

Re: [Python-Dev] Modify PyMem_Malloc to use pymalloc for performance

2016-02-08 Thread Victor Stinner
2016-02-07 9:22 GMT+01:00 Stefan Behnel : > Note that the PyObject_Malloc() functions have never been documented. Yeah, there is an old bug to track this: http://bugs.python.org/issue20064 > And, for example, the "what's new in 2.5" document says: > > """ > Python’s API has

Re: [Python-Dev] Modify PyMem_Malloc to use pymalloc for performance

2016-02-08 Thread Victor Stinner
2016-02-04 15:05 GMT+01:00 M.-A. Lemburg : > Sometimes, yes, but we also do allocations for e.g. > parsing values in Python argument tuples (e.g. using > "es" or "et"): > > https://docs.python.org/3.6/c-api/arg.html > > We do document to use PyMem_Free() on those; not sure whether

[Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Victor Stinner
Hi, Since 3.3, functions of the os module started to emit DeprecationWarning when called with bytes filenames. The rationale is quite simple: Windows native type for filenames is Unicode, and the Windows has a weird behaviour when you use bytes. For example, os.listdir(b'.') gives you paths

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Victor Stinner
2016-02-08 15:32 GMT+01:00 Victor Stinner : > Since 3.3, functions of the os module started to emit > DeprecationWarning when called with bytes filenames. > (...) > Recently, an user complained that os.walk() doesn't work with bytes on > Windows anymore: > (...) It's

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread xiscu
>> New behaviour: >> >> haypo@smithers$ ./python >> Python 3.6.0a0 (default:759a975e1230, Feb 8 2016, 18:21:23) > def f(): >> ... False >> ... Ok, I see in your case there's no return :-) ___ Python-Dev mailing list Python-Dev@python.org

[Python-Dev] HackIllinois 2016 + Python

2016-02-08 Thread Kevin Hong
Hi all! My name is Kevin and I am a staff member of HackIllinois, a 36-hour hackathon at the University of Illinois Urbana-Champaign where students from across the nation come to build some of the most innovative hardware and software projects. For highlights from last year’s event, check out

Re: [Python-Dev] Improving docs for len() of set

2016-02-08 Thread Gregory P. Smith
On Mon, Feb 8, 2016 at 8:24 AM Ben Hoyt wrote: > Hi folks, > > Just a suggestion for a documentation tweak. Currently the docs for len() > on a set say this: > >.. describe:: len(s) > > Return the cardinality of set *s*. > > I'm a relatively seasoned programmer, but

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread francismb
Hi, On 02/08/2016 06:44 PM, Victor Stinner wrote: > Hi, > > I changed the Python compiler to ignore any kind "constant > expressions", whereas it only ignored strings and integers before: > http://bugs.python.org/issue26204 > > The compiler now also emits a SyntaxWarning on such case. IMHO the

Re: [Python-Dev] HackIllinois 2016 + Python

2016-02-08 Thread Alexander Walters
Hello. You might want to post this in the psf-community list too. There are a lot of open source developers in the community they are not working directly on CPython (what this list is about). On 2/8/2016 12:19, Kevin Hong wrote: Hi all! My name is Kevin and I am a staff member of

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Ethan Furman
On 02/08/2016 10:00 AM, francismb wrote: > On 02/08/2016 06:44 PM, Victor Stinner wrote: >> I changed the Python compiler to ignore any kind "constant >> expressions", whereas it only ignored strings and integers before: >> http://bugs.python.org/issue26204 >> >> The compiler now also emits a

[Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Victor Stinner
Hi, I changed the Python compiler to ignore any kind "constant expressions", whereas it only ignored strings and integers before: http://bugs.python.org/issue26204 The compiler now also emits a SyntaxWarning on such case. IMHO the warning can help to detect bugs for developers who just learnt

Re: [Python-Dev] PEP 0492 __aenter__ & __aexit__

2016-02-08 Thread Brett Cannon
On Mon, 8 Feb 2016 at 09:34 Yury Selivanov wrote: > Brett, > > Do you think we should update PEP 492 with links to the docs? I'm > thinking of adding a new section to the top. > Probably. Links around the Internet, search engines, etc. will point to the PEP for a

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Paul Moore
On 8 February 2016 at 14:32, Victor Stinner wrote: > Since 3.3, functions of the os module started to emit > DeprecationWarning when called with bytes filenames. Everywhere? Or just on Windows? I can't tell from your email and I don't have a Unix system to hand to

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Alexander Walters
On 2/8/2016 12:02, Brett Cannon wrote: If Unicode string don't work in Python 2 then what is Python 2/3 to do as a cross-platform solution if we completely remove bytes support in Python 3? Wouldn't that mean there is no common type between Python 2 & 3 that one can use which will work

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Ethan Furman
On 02/08/2016 09:44 AM, Victor Stinner wrote: > Are you ok with the new warning? +1 -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 0492 __aenter__ & __aexit__

2016-02-08 Thread Yury Selivanov
Brett, Do you think we should update PEP 492 with links to the docs? I'm thinking of adding a new section to the top. Yury On 2016-02-06 5:05 PM, Brett Cannon wrote: On Sat, 6 Feb 2016 at 13:50 Daniel Miller > wrote: Hi

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Gregory P. Smith
On Mon, Feb 8, 2016 at 9:44 AM Victor Stinner wrote: > Hi, > > I changed the Python compiler to ignore any kind "constant > expressions", whereas it only ignored strings and integers before: > http://bugs.python.org/issue26204 > > The compiler now also emits a

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Andrew Barnert via Python-Dev
On Monday, February 8, 2016 9:11 AM, Alexander Walters wrote: > > On 2/8/2016 12:02, Brett Cannon wrote: >> >> >> If Unicode string don't work in Python 2 then what is Python 2/3 to do >> as a cross-platform solution if we completely remove bytes support in >>

[Python-Dev] Syntax Highlightning for C API of CPython in VIM

2016-02-08 Thread Stephane Wirtel
Hi everyone, With my talk "Exploring our Python Interpreter", I think this VIM plugin can be useful for the community. It's a syntax highlighter for the C API of CPython 3.5 and 3.6. I used Clang for the parsing and automatically generated the keywords for VIM. PyObject and the others

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Guido van Rossum
On Mon, Feb 8, 2016 at 11:51 AM, Victor Stinner wrote: > Le 8 févr. 2016 8:14 PM, "Guido van Rossum" a écrit : >> Hum. I'm not excited by this idea. It is not bad syntax. > > Do you see an use case for "constant statements" other than strings and >

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Chris Barker
On Mon, Feb 8, 2016 at 6:32 AM, Victor Stinner wrote: > Windows native type for filenames is > Unicode, and the Windows has a weird behaviour when you use bytes. Just to clarify -- what does it currently do for bytes? IIUC, Windows uses UTF-16, so can you pass in

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread John Mark Vandenberg
On Tue, Feb 9, 2016 at 8:20 AM, Victor Stinner wrote: > Le 8 févr. 2016 9:34 PM, "Guido van Rossum" a écrit : >> If you want to do linter integration that should probably be >> integrated with the user's editor, like it is in PyCharm, and IIUC >>

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Ethan Furman
On 02/08/2016 10:15 AM, Ethan Furman wrote: On 02/08/2016 09:44 AM, Victor Stinner wrote: > Are you ok with the new warning? +1 Changing my vote: -1 on the warning +0 on simply removing the unused constant -- ~Ethan~ ___ Python-Dev mailing list

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Victor Stinner
Le 8 févr. 2016 9:10 PM, "Alexander Walters" a écrit : > > I am not keen on a SyntaxWarning. Either something is python syntax, or it is not. Oh I forgot to mention that Python already emits SyntaxWarning, on "assert True" for example. Victor

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Guido van Rossum
On Mon, Feb 8, 2016 at 9:44 AM, Victor Stinner wrote: > I changed the Python compiler to ignore any kind "constant > expressions", whereas it only ignored strings and integers before: > http://bugs.python.org/issue26204 > > The compiler now also emits a SyntaxWarning on

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Andrew Barnert via Python-Dev
> On Feb 8, 2016, at 11:13, Guido van Rossum wrote: > >> On Mon, Feb 8, 2016 at 9:44 AM, Victor Stinner >> wrote: >> I changed the Python compiler to ignore any kind "constant >> expressions", whereas it only ignored strings and integers before: >>

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Victor Stinner
Le 8 févr. 2016 9:34 PM, "Guido van Rossum" a écrit : > If you want to do linter integration that should probably be > integrated with the user's editor, like it is in PyCharm, and IIUC > people can do this in e.g. Emacs, Sublime or Vim as well. Leave the > interpreter alone.

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Guido van Rossum
On Mon, Feb 8, 2016 at 1:20 PM, Victor Stinner wrote: > Le 8 févr. 2016 9:34 PM, "Guido van Rossum" a écrit : >> If you want to do linter integration that should probably be >> integrated with the user's editor, like it is in PyCharm, and IIUC >>

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Alexander Walters
What incantation do you need to do to make that behavior apparent? tritium@gesa:~$ python3.5 -W all Python 3.5.1 (default, Dec 18 2015, 02:15:10) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. Jedi is not installed, falling back to readline >>> assert

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread John Mark Vandenberg
On Tue, Feb 9, 2016 at 8:41 AM, Alexander Walters wrote: > > > On 2/8/2016 16:37, John Mark Vandenberg wrote: >> >> fwiw, pyflakes doesnt detect this. I've created a bug for that >> https://bugs.launchpad.net/pyflakes/+bug/1543246 > > > Flake8 does, so it might be in the

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Alexander Walters
On 2/8/2016 16:37, John Mark Vandenberg wrote: fwiw, pyflakes doesnt detect this. I've created a bug for that https://bugs.launchpad.net/pyflakes/+bug/1543246 Flake8 does, so it might be in the ... poorly named ... pep8 checker. ___ Python-Dev

Re: [Python-Dev] speed.python.org

2016-02-08 Thread Zachary Ware
On Mon, Feb 8, 2016 at 1:09 PM, Yury Selivanov wrote: > Zachary, > > Do you run the benchmarks in rigorous mode? Not currently. I think I need to reschedule when the benchmarks are run anyway, to avoid conflicts with PyPy's usage of that box, and will add rigorous mode

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Victor Stinner
Le 8 févr. 2016 8:14 PM, "Guido van Rossum" a écrit : > Hum. I'm not excited by this idea. It is not bad syntax. Do you see an use case for "constant statements" other than strings and ellipsis? Such statement does nothing. Previously the compiler emited LOAD_CONST+POP_TOP.

Re: [Python-Dev] Improving docs for len() of set

2016-02-08 Thread Ben Hoyt
Thanks! Commit ref: https://hg.python.org/cpython/rev/a67fda8e33b0 -Ben On Mon, Feb 8, 2016 at 1:00 PM, Gregory P. Smith wrote: > > > On Mon, Feb 8, 2016 at 8:24 AM Ben Hoyt wrote: > >> Hi folks, >> >> Just a suggestion for a documentation tweak. Currently

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Alexander Walters
I am not keen on a SyntaxWarning. Either something is python syntax, or it is not. This warning catches something linters have been catching for ages. I really don't see the value in adding this, and can see it causing more confusion than it solves. In the #python irc channel, we see quite

Re: [Python-Dev] speed.python.org

2016-02-08 Thread Yury Selivanov
Zachary, Do you run the benchmarks in rigorous mode? Yury On 2016-02-04 1:48 AM, Zachary Ware wrote: I'm happy to announce that speed.python.org is finally functional! There's not much there yet, as each benchmark builder has only sent one result so far (and one of those involved a bit of

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Yury Selivanov
On 2016-02-08 5:19 PM, Terry Reedy wrote: On 2/8/2016 4:51 PM, Victor Stinner wrote: 2016-02-08 22:28 GMT+01:00 Alexander Walters : What incantation do you need to do to make that behavior apparent? I didn't know. I just checked. It's assert used with a non-empty

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread John Mark Vandenberg
On Tue, Feb 9, 2016 at 8:51 AM, Victor Stinner wrote: > 2016-02-08 22:28 GMT+01:00 Alexander Walters : >> What incantation do you need to do to make that behavior apparent? > > I didn't know. I just checked. It's assert used with a non-empty

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Terry Reedy
On 2/8/2016 4:51 PM, Victor Stinner wrote: 2016-02-08 22:28 GMT+01:00 Alexander Walters : What incantation do you need to do to make that behavior apparent? I didn't know. I just checked. It's assert used with a non-empty tuple: assert ("tuple",) :1: SyntaxWarning:

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Victor Stinner
2016-02-08 22:28 GMT+01:00 Alexander Walters : > What incantation do you need to do to make that behavior apparent? I didn't know. I just checked. It's assert used with a non-empty tuple: >>> assert ("tuple",) :1: SyntaxWarning: assertion is always true, perhaps remove

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Chris Barker
On Mon, Feb 8, 2016 at 3:48 PM, MRAB wrote: > help('assert') > > You'll see that in "assert (True,)", the tuple (an object) is the first > condition (and probably a mistake), whereas in "assert True,", the True is > the condition and the second expression (after

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread eryk sun
On Mon, Feb 8, 2016 at 2:41 PM, Chris Barker wrote: > Just to clarify -- what does it currently do for bytes? IIUC, Windows uses > UTF-16, so can you pass in UTF-16 bytes? Or when using bytes is is assuming > some Windows ANSI-compatible encoding? (and what does it return?)

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread MRAB
On 2016-02-08 23:21, Chris Barker wrote: On Mon, Feb 8, 2016 at 1:51 PM, Victor Stinner > wrote: I didn't know. I just checked. It's assert used with a non-empty tuple: >>> assert ("tuple",) which is more interesting with a

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Chris Barker
On Mon, Feb 8, 2016 at 1:51 PM, Victor Stinner wrote: > I didn't know. I just checked. It's assert used with a non-empty tuple: > > >>> assert ("tuple",) > which is more interesting with a tuple without the parentheses: t = In [*4*]: t = True, In [*5*]: t Out[*5*]:

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Guido van Rossum
The warning for 'assert (cond, msg)' was specifically put in because this is a nasty trap. It's *always* a mistaken attempt to write 'assert cond, msg' -- usually in an attempt to break a long line without using a backslash. I'd actually consider promoting it to a syntax error rather than removing

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Steven D'Aprano
On Mon, Feb 08, 2016 at 05:43:25PM -0500, Yury Selivanov wrote: > > > On 2016-02-08 5:19 PM, Terry Reedy wrote: > >On 2/8/2016 4:51 PM, Victor Stinner wrote: > >>2016-02-08 22:28 GMT+01:00 Alexander Walters : > >>>What incantation do you need to do to make that behavior