R
Roy Smith
Paul Rubin said:That is not what __slot__ is for.
Right. And tuples are not immutable lists (ducking and covering).
Paul Rubin said:That is not what __slot__ is for.
That is not what __slot__ is for.
Really? It seems to work:
It would be enough to have a way to make specific objects and instance
attributes immutable.
Sure, but why have mutable objects all over the place? And, why
always have attributes visible at all, outside the class definition?
The approach in C++ and Java is to have public and private instance
variables, where the private ones are visible only in the class methods.
Bruno Desthuilliers said:Why on earth are you using Python if you don't like the way it work ???
Why on earth are you using Python if you don't like the way it work ???
Why on earth keep releasing new versions of Python if the old ones are
already perfect?
Steven D'Aprano said:*If* you don't like the way it works, and you have a choice in the
matter, perhaps you should find another language that works more the way
you would prefer.
We are in an era for programming languages sort of like the Windows 95
era was for operating systems, where everything is broken but some of
the fixes are beginning to come into view. So there is no language
that currently really works the right way, but some of them including
Python are (one hopes) moving in good directions. Maybe I can help
that process along by posting, maybe not.
Roy Smith said:As the saying goes, "It's possible to write Fortran in any language".
My personal habit is to "declare" all instance variables in the __init__()
method of every class. If there's no better value, I set them to None.
This isn't strictly required, but I think it makes it easier for somebody
reading the code to understand the class.
I'm not a big fan of dogmatic rules, other than the rule that says you
should make your code as easy for somebody else to understand as possible.
r said:Python and Ruby. Ruby only exists in this world because of the things
it took from Python. Nobody would touch Ruby without it's Pythonisms.
Python wins hands down, WHY? you ask. Well i could list a thousand
reasons why but i will only cover a few.
1.) read-ability
2.) ...
I could keep going for days and days. Python is hands down the best
thing that ever happened to the world of programming. Sure it could
use a few improvements, nothing and nobody is perfect. But can any
language stand toe to toe with Python? HELL NO!
I confess to not knowing much about Ruby. It looks sort of Perl-ish
to me, and I always hear it is slower than Python, which is already
too slow.
Those things on your list are all nice, but I think Python has
considerable room for improvement in several areas:
1) Parallelism. Commodity desktop computers now have 8 effective cpu
cores or maybe even 16 soon (Mac Pro, Intel Core i7) but Python still
has the evil GIL that forces all threads to run on one core. Java,
Erlang, and Haskell (GHC) all beat Python in this area. By the time
Python 4 comes out, we will probably all be using PC's with 32 or more
cores, so the current limitations will be intolerable. Even today,
since no one doing anything serious uses single core machines any
more, the GIL is a huge pain in the neck which the multiprocessing
module helps only slightly. (While we are at it, lightweight threads
like Erlang's or GHC's would be very useful.)
2) Native-code compilation. Per the Alioth shootouts, Python is much
slower (even on single cores) than Java, Haskell, ML, or even Scheme.
PyPy is addressing this but it will be a while before it replaces
CPython.
3) Data encapsulation, the subject of most of this thread.
4) Static analysis. It would be great if there were a much more
powerful Pylint that could do ML-like type inference among other
things. You could still program in a dynamic, heterogeneous style if
you wanted to, but Pylint would complain about it unless you supplied
some annotations to tell it where the dynamism was and how to separate
it from the rest of the program. This is consistent with Python's
"consenting adults" principle: if consenting adults want to
participate in a BDSM scene, they should be allowed to. There would
probably have to be some new language features to assist in writing
typefully. Python 3.0 has some gestures in this direction but they
are not yet fully formed.
I believe that the PyPy project is developing the above areas in ways
CPython really could not. While we are now committed to Python 3.0
being a CPython revision that makes some minor (and in my view
somewhat gratuitous) changes to the 2.x series, I hope that Python 4.0
will be based on PyPy and have more substantial differences.
I confess to not knowing much about Ruby. It looks sort of Perl-ish
to me, and I always hear it is slower than Python, which is already
too slow.
r said:Python revolutionized the world of programming and exposed the other
languages for what they are. Archaic, and redundant pieces of
petrified dino dookie. ... We must fight to get Python in every API we
can. We must stay on our toes and not let Ruby one-up us! I do not
want to see Python go down the evolutionary toilet! Lets send Ruby to
programming HELL!
r said:[stevie]
On the other hand... Bruno's question is unfair. It is perfectly
reasonable to (hypothetically) consider Python to be the best
*existing*
language while still wanting it to be improved (for some definition
of
improvement). Just because somebody has criticisms of Python, or a
wish-
list of features, doesn't mean they hate the language.
[/stevie]
WOW Steven, i am very impressed. That's the first thing you have said
in a very long time that i totally agree with! Keep this up and i may
put you back on my Python Brethren list![]()
[...]Really? It seems to work:
Of course the tradition answer to this question is "reframe yourPaul said:I confess to not knowing much about Ruby. It looks sort of Perl-ish
to me, and I always hear it is slower than Python, which is already
too slow.
Those things on your list are all nice, but I think Python has
considerable room for improvement in several areas:
1) Parallelism. Commodity desktop computers now have 8 effective cpu
cores or maybe even 16 soon (Mac Pro, Intel Core i7) but Python still
has the evil GIL that forces all threads to run on one core. Java,
Erlang, and Haskell (GHC) all beat Python in this area. By the time
Python 4 comes out, we will probably all be using PC's with 32 or more
cores, so the current limitations will be intolerable. Even today,
since no one doing anything serious uses single core machines any
more, the GIL is a huge pain in the neck which the multiprocessing
module helps only slightly. (While we are at it, lightweight threads
like Erlang's or GHC's would be very useful.)
Speed, of course, isn't everything. But it would be nice to accommodate2) Native-code compilation. Per the Alioth shootouts, Python is much
slower (even on single cores) than Java, Haskell, ML, or even Scheme.
PyPy is addressing this but it will be a while before it replaces
CPython.
There's always more to do there, though I fell the thread started out3) Data encapsulation, the subject of most of this thread.
That part of Python 3'sw design is, of course, totally intentional. I4) Static analysis. It would be great if there were a much more
powerful Pylint that could do ML-like type inference among other
things. You could still program in a dynamic, heterogeneous style if
you wanted to, but Pylint would complain about it unless you supplied
some annotations to tell it where the dynamism was and how to separate
it from the rest of the program. This is consistent with Python's
"consenting adults" principle: if consenting adults want to
participate in a BDSM scene, they should be allowed to. There would
probably have to be some new language features to assist in writing
typefully. Python 3.0 has some gestures in this direction but they
are not yet fully formed.
I believe that the PyPy project is developing the above areas in ways
CPython really could not. While we are now committed to Python 3.0
being a CPython revision that makes some minor (and in my view
somewhat gratuitous) changes to the 2.x series, I hope that Python 4.0
will be based on PyPy and have more substantial differences.
Steve Holden said:r wrote: (about another Steven)
What can one do to get *off* it? ;-)
'appen so, but if folk 'ud keep it in ther trousers there'd be less onHendrik said:eeh by gum lad - there's nowt for it -
tis direct result of heavy infestation
of people on planet!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.