473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Typed Python?

Moin,

short question: is there any language combining the syntax, flexibility and
great programming experience of Python with static typing? Is there a
project to add static typing to Python?

Thank you,

--
greetz tom
Jul 18 '05
176 8043
Quoth Thomas Reichelt <XX********@gib ts.net>:
| short question: is there any language combining the syntax, flexibility and
| great programming experience of Python with static typing? Is there a
| project to add static typing to Python?

I haven't tried it, but Nice is a Java based language with a more
sophisticated type system than Java, and a few extra conveniences.

http://nice.sourceforge.net/

It doesn't appear to have type inference, which so far as I know
may be exclusive to functional languages, but it does have the
"contract", "interface" etc. stuff that seems to be needed with
statically typed object oriented languages. I can't tell right
away from the web pages, but it looks like subtype polymorphism
is all you get - so for example in a context that expects a File,
you can't show up with something that was just built in the shape
of a File, it has to be a subclass of File. Again as usual with
object oriented languages. But the type system certainly looks
more powerful, the language looks more expressive whatever that
means, and the Java implementation means lots of libraries.

Haskell is a conundrum. Not many known users outside of academia,
some kind of intractable problems that seem likely to keep it that
way, but it has deep roots and has become the archetypal functional
programming language with a supportive community that shows no signs
of withering away. And after all it's an inspiring language to use.
Not like the other relatively popular functional programming language
these days, rather the opposite.

Donn Cave, do**@drizzle.co m
Jul 18 '05 #11
Thomas Reichelt <XX********@gib ts.net> wrote in message news:<2k******* *****@uni-berlin.de>...
Moin,

short question: is there any language combining the syntax, flexibility and
great programming experience of Python with static typing?


Run, run, and run. Do not look back. And for heavens sake: use
"Bigloo".

I was not in dire need for looking back to Python any longer once I
encountered Bigloo:

- types
- object system
- pattern matching
- exception handling
- keywords
- Bee (development environment)
- excellent foreign function interface to C: Bigloo speaks C indeed!
- Java backends (automatically generated from Scheme code)
- .Net integration
- excellent and very stable high perfromance compiler for speed;
performance is on par with OCaml
- nearly on every platform

- and do not forget: though, there are types but you /always/ will get
the option of using Bigloo as it were an ordinary Scheme with all the
freedom so to speak! Types will never be your stumbling block as in
Clean or Haskell for example.
Fensterbrett
PS: Note: with srfi-1 you get a lot of typical functional programming
support! Hey man you can even download the srfi-functions for "lazy
streams".
Jul 18 '05 #12
Marek Baczy?ski wrote:
Dnia Sat, 03 Jul 2004 10:56:24 +0200, Thomas Reichelt napisa?(a):
What I would have in mind is a flag, or maybe language directive, that
switches static typing via type inference on. Of course, some of the
dynamic features of Python would have to be disabled then, but it would
result in better error-checking, and perhaps bytecode compilable to
native code, resulting in faster execution.


Sounds just like Starkiller+Psyc o combo :) (Even though Starkiller is not
released yet AFAIK.)


Starkiller sounds very interesting... I am sure it is worth trying when it's
released!

--
greetz tom
Jul 18 '05 #13
ch********@hotm ail.com wrote:
Thomas Reichelt <XX********@gib ts.net> wrote in message
news:<2k******* *****@uni-berlin.de>...
Moin,

short question: is there any language combining the syntax, flexibility
and great programming experience of Python with static typing?


Run, run, and run. Do not look back. And for heavens sake: use
"Bigloo".

I was not in dire need for looking back to Python any longer once I
encountered Bigloo:


[...]

Thanks, but... Scheme... I hate parens ;)

--
greetz tom
Jul 18 '05 #14
Ville Vainio wrote:
>>"Jarek" == Jarek Zgoda <jz****@gazeta. usun.pl> writes:

Jarek> Static typing would destroy all fun in Python. Eventually
Jarek> we would end with ObjectPascal-like language, just running
Jarek> in VM and not compiled.

Using a type inference system, it wouldn't. The code would "flow" like
it does now. Some corners of the code would probably benefit from
having explicit declarations to smooth up the process, but most of the
code could look exactly the way it does now.


I don't really believe that is true. Many Python functions have
extremely complex type signatures. In a type inferenced language you
don't type in type signatures everywhere but you do define have to
design your types with the inferencer in mind. This would be a big
change in Python programming style.

To put it another way: Jarek complains that static typing would destroy
the "fun". I think he means Python's flexibility. A type inferencer
removes the need to declare types but a statically type-inferenced
language is still statically typed. It will still be strict about type
usage.

Paul Prescod

Jul 18 '05 #15
Thomas Reichelt <XX********@gib ts.net> wrote in message news:<2k******* *****@uni-berlin.de>...
Thanks, but... Scheme... I hate parens ;)


Do not take the following patronizing. But why to you believe that you
hate parens?

You put yourself into big troubles if you miss the opportunity of
Bigloo. I haven't counted parens or had to cope with it in any time I
can think of since parens will never come in your way. Why should
parens interfere with your way?

The code is much better structured in Scheme than in Python. It is a
big mistake to assume that Python displays any readability. The one
and only thing, provided I were a teacher, which I would never use for
annoying school people in introductory courses would be Python for its
huge learning curve and its messy behavior.

You should give Scheme a try.

Fensterbrett
Jul 18 '05 #16
ch********@hotm ail.com wrote:
Thomas Reichelt <XX********@gib ts.net> wrote in message
news:<2k******* *****@uni-berlin.de>...
Thanks, but... Scheme... I hate parens ;)
Do not take the following patronizing. But why to you believe that you
hate parens?

You put yourself into big troubles if you miss the opportunity of
Bigloo. I haven't counted parens or had to cope with it in any time I
can think of since parens will never come in your way. Why should
parens interfere with your way?


Because the syntax of Scheme, Lisp etc. is strange to me. I don't speak
lightly, 'cause I have tried some of the dialects (although it was a long
time ago). It was not that I couldn't write correct code in it, but after
implementing some of my "test" programs that I write in every new language
I try, I looked at them and thought "O my god, what a mess". Guess that
it's my brain fooling me...
The code is much better structured in Scheme than in Python. It is a
big mistake to assume that Python displays any readability. The one
and only thing, provided I were a teacher, which I would never use for
annoying school people in introductory courses would be Python for its
huge learning curve and its messy behavior.


This is coming close to trolling, IMHO.

--
greetz tom
Jul 18 '05 #17
On Sun, 04 Jul 2004 10:18:18 +0200, Thomas Reichelt
<XX********@gib ts.net> wrote:
The code is much better structured in Scheme than in Python. It is a
big mistake to assume that Python displays any readability. The one
and only thing, provided I were a teacher, which I would never use for
annoying school people in introductory courses would be Python for its
huge learning curve and its messy behavior.


This is coming close to trolling, IMHO.


Perhaps it is.

But as an advocate of the potential of Python in education, it is to
me not unitneresting to hear, and I do not totally discount the point
of view.

Learning curve, messiness aside - there is little question to be that
the Scheme community has approached the issue of the role of
programming education, as an element of an *education* in general, in
more mature, sophisticated, and honest ways then I have generally
noticed in the Python community.

I recently reread the introduction to How to Design Programs, which is
a book that is part of the TeachScheme project.

http://www.htdp.org/2003-09-26/Book/...ml#node_chap_1

It expresses in a few paragtraphs some of the inescapable
fundamentals:

"Becoming and being a programmer is fun, but it is not easy."

"Programmin g a computer requires patience and concentration. Only
attention to minute details will avoid frustrating grammatical
mistakes."

The obvious.

Much of what you hear in the Python world regarding education sounds
different.

"Python is easy, and learning to program with Python is easy."

Often implying that it is only that others are making the effort in
languages other than Python that makes it seem otherwise.

Which is wonderful to hear, and would be worth saying, if saying it
would make it true.

Of course, it doesn't.

Of course, its nonsense.
Art
Jul 18 '05 #18
>>>>> "Chain" == chain lube <ch********@hot mail.com> writes:
Chain> You put yourself into big troubles if you miss the
Chain> opportunity of Bigloo.

I agree. Should I also forward this message to 10 other people to
dodge the impending doom?

Chain> The code is much better structured in Scheme than in
Chain> Python. It is a big mistake to assume that Python displays
Chain> any readability. The one

So true.

(set! x 10)

Is so much more readable than

x=10

Chain> annoying school people in introductory courses would be
Chain> Python for its huge learning curve and its messy behavior.

With all due respect, someone that thinks python has a huge learning
curve must be a little bit on the slow side, cognition-wise.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #19
>>>>> "Arthur" == Arthur <aj******@opton line.com> writes:

Arthur> "Python is easy, and learning to program with Python is
Arthur> easy."

Arthur> Often implying that it is only that others are making the
Arthur> effort in languages other than Python that makes it seem
Arthur> otherwise.

Arthur> Which is wonderful to hear, and would be worth saying, if
Arthur> saying it would make it true.

Arthur> Of course, it doesn't.

Arthur> Of course, its nonsense.

Well, many of us just think it's true. Only the academics seem to
think Scheme is easier to learn than, say Python or even C. Students
often disagree.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.