.cy extension

83 views
Skip to first unread message

Shriramana Sharma

unread,
May 8, 2013, 3:12:21 AM5/8/13
to cython...@googlegroups.com
I always wondered why you people never chose to give Cython files a
different extension based on "Cy". module.cy etc would have been
totally cool IMO. Since Cython is not Pyrex, although it may have been
derived from it, is there a reason that .cy wasn't chosen?

--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा

Robert Bradshaw

unread,
May 8, 2013, 3:36:00 AM5/8/13
to cython...@googlegroups.com
On Wed, May 8, 2013 at 12:12 AM, Shriramana Sharma <sam...@gmail.com> wrote:
> I always wondered why you people never chose to give Cython files a
> different extension based on "Cy". module.cy etc would have been
> totally cool IMO. Since Cython is not Pyrex, although it may have been
> derived from it, is there a reason that .cy wasn't chosen?

The .cy extension was actually considered, but there really wasn't a
compelling reason to change. Especially back when Pyrex and Cython
were nearly interchangeable (and still most Pyrex code is valid Cython
code, the biggest difference being in how C++ declarations are
handled).

Personally, I think of .pyx being a variant of .py rather than a take
on Pyrex, and listing "*.p*" or "*.py*" is a handy thing to be able to
do. There's already a lot of .pyx files out there, I worry that .cy
may cause confusion (though certainly something to consider if we want
to make backwards incompatible changes to the syntax).

- Robert

Stefan Behnel

unread,
May 8, 2013, 3:56:32 AM5/8/13
to cython...@googlegroups.com
Robert Bradshaw, 08.05.2013 09:36:
Yep, I also think that having two extensions for the same thing is just
going to cause confusion and needless "upgrade" and "compatibility" concerns.

Reading ".pyx" as "Python eXtended" makes a lot of sense to me, since the
Cython language is really an almost complete superset of the Python
language theses days, i.e. almost all Python code is valid Cython code,
too, and the remaining gap continuous to vanish.

Stefan

Shriramana Sharma

unread,
May 8, 2013, 7:43:44 AM5/8/13
to cython...@googlegroups.com
On Wed, May 8, 2013 at 1:26 PM, Stefan Behnel <stef...@behnel.de> wrote:
> Yep, I also think that having two extensions for the same thing is just
> going to cause confusion and needless "upgrade" and "compatibility" concerns.

OK thanks both of you for your replies -- but are there any problems
if someone (me) wants to use .cy? I mean, is pyx hardcoded into the
software somewhere?

Henry Gomersall

unread,
May 8, 2013, 7:54:13 AM5/8/13
to cython...@googlegroups.com
On Wed, 2013-05-08 at 17:13 +0530, Shriramana Sharma wrote:
> On Wed, May 8, 2013 at 1:26 PM, Stefan Behnel <stef...@behnel.de>
> wrote:
> > Yep, I also think that having two extensions for the same thing is
> just
> > going to cause confusion and needless "upgrade" and "compatibility"
> concerns.
>
> OK thanks both of you for your replies -- but are there any problems
> if someone (me) wants to use .cy? I mean, is pyx hardcoded into the
> software somewhere?

Feynman, in one of his writings, talked about inventing a new set of
notation for differentiation because dx looked like `d` times `x` and so
he didn't like it. He realised a bit later when his interactions with
other people broke (because they didn't have a clue what he was talking
about) just what the value is of sticking to the standard, even when
that seems unappealing for some reason.

That is, the primary value of a standard is not necessarily to be the
best, but to be a standard.

cheers,

hen

Stefan Behnel

unread,
May 8, 2013, 7:56:39 AM5/8/13
to cython...@googlegroups.com
Shriramana Sharma, 08.05.2013 13:43:
> On Wed, May 8, 2013 at 1:26 PM, Stefan Behnel wrote:
>> Yep, I also think that having two extensions for the same thing is just
>> going to cause confusion and needless "upgrade" and "compatibility" concerns.
>
> OK thanks both of you for your replies -- but are there any problems
> if someone (me) wants to use .cy? I mean, is pyx hardcoded into the
> software somewhere?

You may get away with .cy instead of .pyx, at least in most cases, but .cyd
won't work because Cython will look for .pxd files. And I don't want to add
the complexity to Cython to have it look for alternative extensions.

So, my answer is: don't do it. You'll just run into problems at some point
and others will fail to understand what you are doing because you don't do
it The One Right Way everyone else does it.

Stefan

Shriramana Sharma

unread,
May 8, 2013, 11:04:57 AM5/8/13
to cython...@googlegroups.com
On Wed, May 8, 2013 at 5:26 PM, Stefan Behnel <stef...@behnel.de> wrote:
> And I don't want to add
> the complexity to Cython to have it look for alternative extensions.

OK I still think it would be cool if Cython had had its own extension,
but I understand that coolness is not a criterion for decisions that
would affect functionality.

@Henry: I am flattered by the comparison to Feynman. ;-)
Reply all
Reply to author
Forward
0 new messages