POLL: default to Py3 syntax in Python 3 jupyter kernels?

37 views
Skip to first unread message

Stefan Behnel

unread,
Sep 2, 2016, 3:52:07 AM9/2/16
to Cython-users
Hi!

Here's a quick poll. Currently, Cython defaults to its Python 2 based
syntax everywhere and full Python 3 syntax and semantics have to be enabled
with the "language_level=3" directive, or with the "%%cython -3" cell magic
in IPython/jupyter notebooks.

In the jupyter notebook, however, the Python version, and thus the syntax
used in the overall notebook, is determined by the running kernel. If that
uses Python 3 syntax for the Python cells, it feels weird to me to require
Python 2 syntax in the Cython cells.

Would anyone object to making Python 3 syntax the default in Cython cells
when using a Python 3 kernel? Do you see any drawbacks?

Personally, I doubt that it would break all that much code. And Python 2
syntax could still be selected with "%%cython -2" if needed.

Stefan

Francesc Alted

unread,
Sep 2, 2016, 4:16:29 AM9/2/16
to cython...@googlegroups.com
+1 for Python 3 syntax as default.


Stefan

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Francesc Alted

MinRK

unread,
Sep 2, 2016, 5:25:56 AM9/2/16
to cython...@googlegroups.com
+1 to matching the interpreter by default in the magic.

-Min

Stefan Behnel

unread,
Sep 2, 2016, 10:56:48 AM9/2/16
to cython...@googlegroups.com
I've pushed this change to master. Let's see if we hear anyone screaming
when we release it. :)

Stefan

Robert Bradshaw

unread,
Sep 2, 2016, 4:06:20 PM9/2/16
to cython...@googlegroups.com
I'm in favor of matching the environment.
>>> email to cython-users...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> --
>> Francesc Alted
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "cython-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to cython-users...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "cython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cython-users...@googlegroups.com.

Fernando Perez

unread,
Sep 2, 2016, 8:47:48 PM9/2/16
to cython-users
On Fri, Sep 2, 2016 at 2:25 AM, MinRK <benja...@gmail.com> wrote:
+1 to matching the interpreter by default in the magic.

+1, that would be best semantics IMO


--
Fernando Perez (@fperez_org; http://fperez.org)
fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
fernando.perez-at-berkeley: contact me here for any direct mail

Big Stone

unread,
Sep 4, 2016, 11:27:13 AM9/4/16
to cython-users, stef...@behnel.de
If Cython syntax was 100% compatible with Python syntax, current situation ("legacy syntax" or "not released syntax) would be considered as a bug.

"+1" for this change

Stefan Behnel

unread,
Sep 4, 2016, 3:07:22 PM9/4/16
to cython...@googlegroups.com
Big Stone schrieb am 04.09.2016 um 17:27:
> If Cython syntax was 100% compatible with Python syntax, current situation
> ("legacy syntax" or "not released syntax) would be considered as a bug.

My personal take on this is that a) it's compatible enough for all
realistic use cases and b) the special "cdef" syntax is not going to go
away, ever, because it's very concise and well adapted to its purpose.

Stefan

Robert Bradshaw

unread,
Sep 5, 2016, 1:26:23 PM9/5/16
to cython...@googlegroups.com
On Sun, Sep 4, 2016 at 8:27 AM, Big Stone <stone...@gmail.com> wrote:
> If Cython syntax was 100% compatible with Python syntax, current situation
> ("legacy syntax" or "not released syntax) would be considered as a bug.

I'm not quite following what you're saying here--the question would
still be whether to be 100% compatible with Python 2 syntax or 100%
compatible with Python 3 syntax,

> "+1" for this change
>
>
>
>
> On Friday, September 2, 2016 at 9:52:07 AM UTC+2, Stefan Behnel wrote:
>>
>> Hi!
>>
>> Here's a quick poll. Currently, Cython defaults to its Python 2 based
>> syntax everywhere and full Python 3 syntax and semantics have to be
>> enabled
>> with the "language_level=3" directive, or with the "%%cython -3" cell
>> magic
>> in IPython/jupyter notebooks.
>>
>> In the jupyter notebook, however, the Python version, and thus the syntax
>> used in the overall notebook, is determined by the running kernel. If that
>> uses Python 3 syntax for the Python cells, it feels weird to me to require
>> Python 2 syntax in the Cython cells.
>>
>> Would anyone object to making Python 3 syntax the default in Cython cells
>> when using a Python 3 kernel? Do you see any drawbacks?
>>
>> Personally, I doubt that it would break all that much code. And Python 2
>> syntax could still be selected with "%%cython -2" if needed.
>>
>> Stefan
>

Big Stone

unread,
Sep 6, 2016, 12:33:12 PM9/6/16
to cython-users
Hi,

I vote for "100% compatible with Python syntax of the running Python Kernel interpreter" .

Hai Nguyen

unread,
Sep 6, 2016, 12:58:51 PM9/6/16
to cython-users
On Tue, Sep 6, 2016 at 12:33 PM, Big Stone <stone...@gmail.com> wrote:
Hi,

I vote for "100% compatible with Python syntax of the running Python Kernel interpreter" .

 

me too.

Hai
Reply all
Reply to author
Forward
0 new messages