nicolasessisbreton / fython

Fython is Fortran with a Python syntax
Other
40 stars 1 forks source link

Why hybrid language, not Python with type annotations? #3

Closed den-run-ai closed 8 years ago

den-run-ai commented 8 years ago

Why hybrid language, not Python with type annotations? E.g. like Cython, numba, pythran?

nicolasessisbreton commented 8 years ago

One of the great point in Python is its clean syntax. I wanted this to transpire to Fython, so that even the definition of an involved type like real(c_float) dimension(:, :, :) allocatable contiguous x

is perfectly readable and the intention is understood at a glimpse.

With a type annotation system, this would be x = Real(kind=c_float, dimension=[a, a, a], allocatable=1, contiguous=1)

The colon is invalid syntax in Python so, something else must be used (above 'a' for assumed). You can see the problem. That just for elementary type. For higher objects such as function and class, annotations will take them away from Python clarity principle.