Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Does Python really follow its philosophy of "Readability counts"?

Reply
Thread Tools

Does Python really follow its philosophy of "Readability counts"?

 
 
Roy Smith
Guest
Posts: n/a
 
      01-12-2009
In article <(E-Mail Removed)>,
Paul Rubin <http://(E-Mail Removed)> wrote:

> http://www.velocityreviews.com/forums/(E-Mail Removed) writes:
> > > * *class Foo (DynamicAttributes, object): pass
> > >

> > You cannot do that, but you can establish a fixed set of attributes by
> > defining the __slot__ class variable.

>
> That is not what __slot__ is for.


Right. And tuples are not immutable lists (ducking and covering).
 
Reply With Quote
 
 
 
 
bieffe62@gmail.com
Guest
Posts: n/a
 
      01-12-2009
On 12 Gen, 14:45, Paul Rubin <http://(E-Mail Removed)> wrote:
> (E-Mail Removed) writes:
> > > * *class Foo (DynamicAttributes, object): pass

>
> > You cannot do that, but you can establish a fixed set of attributes by
> > defining the __slot__ class variable.

>
> That is not what __slot__ is for.



Really? It seems to work:

>>> class A(object):

.... __slots__ = ('a', 'b')
.... def __init__(self): self.not_allowed = 1
....
>>> a = A()

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "<interactive input>", line 3, in __init__
AttributeError: 'A' object has no attribute 'not_allowed'
>>>


Ciao
-----
FB
 
Reply With Quote
 
 
 
 
Marc 'BlackJack' Rintsch
Guest
Posts: n/a
 
      01-12-2009
On Mon, 12 Jan 2009 07:42:47 -0800, bieffe62 wrote:

> On 12 Gen, 14:45, Paul Rubin <http://(E-Mail Removed)> wrote:
>> (E-Mail Removed) writes:
>> > > Â* Â*class Foo (DynamicAttributes, object): pass

>>
>> > You cannot do that, but you can establish a fixed set of attributes
>> > by defining the __slot__ class variable.

>>
>> That is not what __slot__ is for.

>
>
> Really? It seems to work:


It works but it is not what `__slot__` was invented for. Some call it a
misuse of that feature if you use it to prevent adding attributes
dynamically. And it has some drawbacks when you inherit from such
classes.

Ciao,
Marc 'BlackJack' Rintsch
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      01-12-2009
Paul Rubin a écrit :
> Carl Banks <(E-Mail Removed)> writes:
>>> The criticism is very valid. Some languages do support immutable
>>> variables (e.g. "final" declarations in Java, "const" in C++, or
>>> universal immutability in pure functional languages) and they do so
>>> precisely for the purpose of taming the chaos of uncontrolled
>>> mutation. It would be great if Python also supported immutability.

>> I don't think what you said (which is fine) makes his criticism valid,
>> unless you also suggest that all objects should be immutable.

>
> It would be enough to have a way to make specific objects and instance
> attributes immutable.
>
>> If any objects are mutable, you have to be prepared for objects to
>> mutated outside the initializer.

>
> 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.


Why on earth are you using Python if you don't like the way it work ???
 
Reply With Quote
 
Paul Rubin
Guest
Posts: n/a
 
      01-12-2009
Bruno Desthuilliers <(E-Mail Removed)> writes:
> 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?
 
Reply With Quote
 
r
Guest
Posts: n/a
 
      01-12-2009
On Jan 12, 2:06*pm, Bruno Desthuilliers
<(E-Mail Removed)> wrote:
> Why on earth are you using Python if you don't like the way it work ???


Why on earth are you busting into someone's thread just because you
don't like what they have to say ???

 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-12-2009
On Mon, 12 Jan 2009 13:36:07 -0800, Paul Rubin wrote:

> Bruno Desthuilliers <(E-Mail Removed)> writes:
>> 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?


That's a fallacious argument. Nobody is arguing that any specific version
of Python is perfect, but clearly many people do like the general design
choices of the language, that is, the way it works.

*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.

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.



--
Steven
 
Reply With Quote
 
r
Guest
Posts: n/a
 
      01-12-2009
[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

 
Reply With Quote
 
Paul Rubin
Guest
Posts: n/a
 
      01-12-2009
Steven D'Aprano <(E-Mail Removed)> writes:
> *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.
 
Reply With Quote
 
r
Guest
Posts: n/a
 
      01-12-2009
On Jan 12, 3:58*pm, Paul Rubin <http://(E-Mail Removed)> wrote:
> 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.


Paul,
Python is the best hope for readable, maintainable very high-level
coding. Python forged the path and showed all other languages for what
they truly are; archaic, redundant, pieces of complete rubbish! In my
mind only 2 languages stand out in the very high level category;
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.) learn-ability
3.) maintain-ability
4.) perfect choice of keywords
5.) no end statement, braces, or lisps!
6.) no forced capitalizations
7.) modules are the actual script name
8.) introspection
9.) class, and class inheritance is beautiful
8.) true procedural support(no instance vars needed)
10.) loads of quality documentation!
11.) IDLE
12.) Guido (the genius that made all this happen!)

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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Its a bird, its a plane, its.. um, an Attribute based System? thunk Ruby 14 04-03-2010 10:08 AM
Its a bird, its a plane, its.. um, an Attribute based System? thunk Ruby 0 04-01-2010 10:25 PM
Its a bird, its a plane, no ummm, its a Ruide thunk Ruby 1 03-30-2010 11:10 AM
Does the Python community really follow the philospy of "CommunityMatters?" r Python 16 02-02-2009 08:21 PM
Its really NOT the camera, its the PICTURE Larry Digital Photography 7 06-02-2004 06:07 AM



Advertisments