Python 3 consistency proposal

G

gert

Rename all built in classes with a capital letter
example Str() Int() Object()

Make () optional for a function definition
class Test:
pass

def test:
pass

Any chance Guido would approve this :)
 
D

Daniel Fetchinson

Rename all built in classes with a capital letter
example Str() Int() Object()
Why?

Make () optional for a function definition
class Test:
pass

def test:
pass
Why?

Any chance Guido would approve this :)

In my estimation, the chance that Guido would approve this is less
than 10^(-26).

Cheers,
Daniel
 
S

Steven D'Aprano

Rename all built in classes with a capital letter example Str() Int()
Object()

Make () optional for a function definition class Test:
pass

def test:
pass

Any chance Guido would approve this :)

Unless you're volunteering to produce a patch, the chances are zero.

If you *are* willing to do the work, the chances would still be pretty
slim. Guido has just rejected a patch adding PEP 8 compliant aliases for
types like datetime, so I think replacing built-ins have all-but zero
chance. But if you want to pursue it, the right place is the python-ideas
mailing list. Go for it ... but be prepared to justify the change, and
not just "for consistency". As Guido has quoted before, "A foolish
consistency is the hobgoblin of little minds".
 
G

gert

Unless you're volunteering to produce a patch, the chances are zero.

If you *are* willing to do the work, the chances would still be pretty
slim. Guido has just rejected a patch adding PEP 8 compliant aliases for
types like datetime, so I think replacing built-ins have all-but zero
chance. But if you want to pursue it, the right place is the python-ideas
mailing list. Go for it ... but be prepared to justify the change, and
not just "for consistency". As Guido has quoted before, "A foolish
consistency is the hobgoblin of little minds".

Its only foolish because it breaks everything, but it would not be
foolish on a syntax level.
Not that I can't live without, but I am just wondering why they did
not do this in the first place?
 
T

Terry Reedy

No. He just made clear today that he values stability over
non-functional consistency changes -- especially now that 3.0 is out.
Its only foolish because it breaks everything, but it would not be
foolish on a syntax level.
Not that I can't live without, but I am just wondering why they did
not do this in the first place?

As I remember, int, str, etc, once *were* functions (or at best types)
rather than callable class objects. Before 2.2, built-in types and
user-defined classes were separate categories of entities.

tjr
 
B

Bruno Desthuilliers

Ben Finney a écrit :
Steven D'Aprano said:
If you *are* willing to do the work, the chances would still be
pretty slim. Guido has just rejected a patch adding PEP 8 compliant
aliases for types like datetime […] As Guido has quoted before, "A
foolish consistency is the hobgoblin of little minds".

Indeed, that quote is prominent in PEP 8 itself.


gert said:
Not that I can't live without, but I am just wondering why they did
not [name built-in types consistently with other classes] in the
first place?

Because, in the first place, built-in types were disjoint from
user-defined classes. The latter could not derive from the former, and
it was helpful to know the difference.

The reason no longer exists (since built-in types and user types are
now in a unified hierarchy), but the difference is well entrenched now
and I personally see little benefit in changing it.

<mode="not a chance">
Also and FWIW, since there's no functional nor syntaxical differences
between a call to a function returning an object and a call to a class,
if we where to rename anything, it would be better to drop the MixedCase
convention for classes and rename *all* types to all_lower. That way,
you can safely rewrite a class as a factory function (or a factory
function as a class) without having to choose between breaking the API
or violating pep08 !-)
</mode>
 
C

Colin J. Williams

gert said:
Rename all built in classes with a capital letter
example Str() Int() Object()

Make () optional for a function definition
class Test:
pass

def test:
pass

Any chance Guido would approve this :)
Zero.

But I like the idea. Is version 3
really sacrosanct? I wonder how much
it's used so far.

Colin W.
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top