469,331 Members | 5,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

How a smart editor could make "Postfix type declarations PEP3117" inPython3000 more readable

Hi

I read the PEP 3117 about the new "Postfix type declarations" in
Python3000.
THIS PEP as been REJECTED ! But ...

The notation in the PEP is very ugly ! This make python code more
difficult to read!

Anyway when I switched to python (from C, C++, ..), I suffered a lot
of the
untyped python variables. And I think this is a good idea to include
typing in python.

Then I get this idea: The editor could hide the typing notation, just
displaying hint !
It could also auto-complete the type of any variable having already a
type in
the current function, and underline untyped variable or variable
having multiple type inside the function.

Just an idea !
Alain Spineux

Happy new year.
Jan 5 '08 #1
7 1073
On Fri, 04 Jan 2008 19:39:13 -0800, aspineux wrote:
Hi

I read the PEP 3117 about the new "Postfix type declarations" in
Python3000.
THIS PEP as been REJECTED ! But ...

The notation in the PEP is very ugly ! This make python code more
difficult to read!
Please look at the date on the PEP:

http://www.python.org/dev/peps/pep-3117/
--
Steven
Jan 5 '08 #2
aspineux wrote:
Hi

I read the PEP 3117 about the new "Postfix type declarations" in
Python3000.
THIS PEP as been REJECTED !
Of course. That was a joke.
And I think this is a good idea to include typing in python.
Python doesn't really need explicit type declarations.
They're not needed for correctness, and they're not needed for
performance. Take a look at Shed Skin, which is able to hard-compile Python
using type inference without explicit type declarations.

(I'm writing as someone who's used and liked very strictly typed
languages like Ada and Modula. Python actually does unusually well
without declarations. Most languages that don't have declarations
run into difficulties. Consider Basic, TCL, and Matlab, to name
three rather diverse examples. Python managed to avoid the problems
those languages have.)

John Nagle
Jan 5 '08 #3
On Jan 4, 10:07 pm, John Nagle <na...@animats.comwrote:
aspineux wrote:
Hi
I read the PEP 3117 about the new "Postfix type declarations" in
Python3000.
THIS PEP as been REJECTED !

Of course. That was a joke.
And I think this is a good idea to include typing in python.

Python doesn't really need explicit type declarations.
They're not needed for correctness, and they're not needed for
performance. Take a look at Shed Skin, which is able to hard-compile Python
using type inference without explicit type declarations.

(I'm writing as someone who's used and liked very strictly typed
languages like Ada and Modula. Python actually does unusually well
without declarations. Most languages that don't have declarations
run into difficulties. Consider Basic, TCL, and Matlab, to name
three rather diverse examples. Python managed to avoid the problems
those languages have.)

John Nagle
Interesting. And how did it do that?
Jan 5 '08 #4
John Nagle <na***@animats.comwrites:
(I'm writing as someone who's used and liked very strictly typed
languages like Ada and Modula.
Python is strictly typed (also known as "strongly typed"
<URL:http://en.wikipedia.org/wiki/Strongly-typed>), because its
objects know exactly what type they are and won't contort themselves
into another type unless there's an explicitly defined method for
doing so.

I think you mean you're accustomed to "statically-typed languages",
where names are restricted at compile-time in what values they can
refer to. This is as opposed to Python being a "dynamically-typed
language": names are not restricted in the type of object they can be
bound to, and the type of a value is determined when that value is
created <URL:http://en.wikipedia.org/wiki/Type_system#Type_checking>.
Python actually does unusually well without declarations. Most
languages that don't have declarations run into difficulties.
Consider Basic, TCL, and Matlab, to name three rather diverse
examples. Python managed to avoid the problems those languages
have.)
Those three diverse examples are all weakly typed languages. Since
Python is strongly-typed and dynamically-typed, this could largely
explain the difference you see in Python "doing unusually well without
declarations" compared to those languages.

--
\ "It is the responsibility of intellectuals to tell the truth |
`\ and expose lies." -- Noam Chomsky |
_o__) |
Ben Finney
Jan 6 '08 #5
Since
Python is strongly-typed and dynamically-typed, this
--
Hyphenating after "ly" is grammatically incorrect.
\ "It is the responsibility of intellectuals to tell the truth |
`\ and expose lies." -- Noam Chomsky
Never quote Noam Chomsky on "truth." He wouldn't know it if it bit
him.

Nice post otherwise. I'm just fooling around.
Jan 6 '08 #6
On Jan 5, 7:07 am, John Nagle <na...@animats.comwrote:
Python doesn't really need explicit type declarations.
They're not needed for correctness, and they're not needed for
performance. Take a look at Shed Skin, which is able to hard-compile Python
using type inference without explicit type declarations.
ShedSkin is not Python.

Jan 6 '08 #7
aspineux a écrit :
Hi

I read the PEP 3117 about the new "Postfix type declarations" in
Python3000.
THIS PEP as been REJECTED !
Indeed - it's an april's fool joke !-)

And BTW, no need to scream, we hear you pretty well.
But ...

The notation in the PEP is very ugly ! This make python code more
difficult to read!

Anyway when I switched to python (from C, C++, ..), I suffered a lot
of the
untyped python variables.
And I think this is a good idea to include
typing in python.
The concept of "type" greatly differs between static typing and dynamic
typing. FWIW, it also somewhat differs between declarative static type
systems (C/C++/Java/etc) and inference-based static type systems (OCaml,
Haskell etc).

Anyway, Python is dynamically typed (FWIW, it's dynamic almost
everywhere), and this is probably not going to change in a foreseeable
future. So I guess you'd better learn to use dynamic typing instead of
trying to write C++ in Python - or, if you just can't get used to
dynamic typing, use another language.

Jan 9 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mikko Rantalainen | last post: by
reply views Thread by M | last post: by
4 posts views Thread by Don Wash | last post: by
8 posts views Thread by David Cameron | last post: by
8 posts views Thread by Oliver Graeser | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.