Author Topic: Cython?  (Read 2568 times)

0 Members and 1 Guest are viewing this topic.

Offline xtrafrood

  • formerly csmertx
  • * Elevated Elder
  • Thread Starter
  • Posts: 2716
  • Location: Gainesville, FL
  • KA2 touchpad on top
    • csmertx.com
Cython?
« on: Wed, 30 January 2019, 23:37:29 »
~30 lines of Python compiled into +3k lines of C.. So uh, any other GH users 'play' with Cython? Cython seems like an awesome box of the Pandora variety.
(sold) Chris Schammert (Christopher Schammert)

Offline pr0ximity

  • Posts: 2708
  • Location: Maine
Re: Cython?
« Reply #1 on: Thu, 31 January 2019, 05:33:56 »
I've wanted to try writing some C extensions for Python but never had a use case really. What do you do?
| Flickr | KMAC 1.2 | GON NeRD TKL | GSKT-00-Z | GSKT-00-AEK | GON NeRD 60 | Jane V2 CE | Whale | J80S | 356CL DGE | G80-5000 HAMDE | IBM 1390120 | IBM F AT | IBM F122 | IBM 3101 | Zenith Z-150

Offline Findecanor

  • Posts: 5082
  • Location: Koriko
Re: Cython?
« Reply #2 on: Thu, 31 January 2019, 06:19:45 »
I wonder, how does Cython work together with C extensions for Python? Would they have to be modified extensively?
🍉

Offline xtrafrood

  • formerly csmertx
  • * Elevated Elder
  • Thread Starter
  • Posts: 2716
  • Location: Gainesville, FL
  • KA2 touchpad on top
    • csmertx.com
Re: Cython?
« Reply #3 on: Thu, 31 January 2019, 08:14:13 »
IDK, I fed a small tkinter python script to Cython and it rendered a .c file for me to compile with gcc or mingw-w64.

Although my Cython usage is limited to this one instance, I can say my first binary output was a success.

When I execute the new tkinter script turned binary it renders a window with three buttons. From what I can tell there is no behavior difference. Which I think is interesting.
(sold) Chris Schammert (Christopher Schammert)

Offline joey

  • Posts: 2296
  • Location: UK
Re: Cython?
« Reply #4 on: Thu, 31 January 2019, 09:49:22 »
IDK, I fed a small tkinter python script to Cython and it rendered a .c file for me to compile with gcc or mingw-w64.

Although my Cython usage is limited to this one instance, I can say my first binary output was a success.

When I execute the new tkinter script turned binary it renders a window with three buttons. From what I can tell there is no behavior difference. Which I think is interesting.

Paste the C code somewhere!

Offline xtrafrood

  • formerly csmertx
  • * Elevated Elder
  • Thread Starter
  • Posts: 2716
  • Location: Gainesville, FL
  • KA2 touchpad on top
    • csmertx.com
Re: Cython?
« Reply #5 on: Thu, 31 January 2019, 10:44:08 »
IDK, I fed a small tkinter python script to Cython and it rendered a .c file for me to compile with gcc or mingw-w64.

Although my Cython usage is limited to this one instance, I can say my first binary output was a success.

When I execute the new tkinter script turned binary it renders a window with three buttons. From what I can tell there is no behavior difference. Which I think is interesting.

Paste the C code somewhere!

Okelydokely :).  I included the original (bad) python script too.

exit_menu.py ... exit_menu.c
« Last Edit: Thu, 31 January 2019, 10:47:50 by csmertx »
(sold) Chris Schammert (Christopher Schammert)

Offline JP

  • Posts: 359
  • Location: Indianapolis, IN ander, our true elevated elder.
Re: Cython?
« Reply #6 on: Thu, 31 January 2019, 10:55:04 »
That is a big and scary C program  :eek: I am thinking even a simple hello world would also be similar.
About Me | The Collection
Therapy is expensive so I buy keyboards and bike parts.

Offline xtrafrood

  • formerly csmertx
  • * Elevated Elder
  • Thread Starter
  • Posts: 2716
  • Location: Gainesville, FL
  • KA2 touchpad on top
    • csmertx.com
Re: Cython?
« Reply #7 on: Thu, 31 January 2019, 12:03:16 »
That is a big and scary C program  :eek: I am thinking even a simple hello world would also be similar.

Although I'd imagine collaboration with such a C program would be.. uh.. less than stellar, IIRC GUI creation requires a few more lines than the average Hello World program.
(sold) Chris Schammert (Christopher Schammert)