Python slang

Steven D'Aprano steve+python at pearwood.info
Fri Aug 5 21:55:00 EDT 2016


On Sat, 6 Aug 2016 08:31 am, Chris Angelico wrote:

> On Sat, Aug 6, 2016 at 8:00 AM, Marco Sulla via Python-list
> <python-list at python.org> wrote:
[...]
>> I'm referring to:
>> * `except` instead of `catch`
> 
> Not sure. Python does seem to be roughly unique in this.

Delphi does uses the same terminology. Standard Pascal is too old and
doesn't support exceptions, but newer variants that do seem to use some
form of "except".



>> * `raise` instead of `throw`
> 
> Quite a few other languages talk about raising exceptions rather than
> throwing them. Those would be the two most common terms, I think.

Indeed.

 
>> * `self` instead of `this` (I know, it's not enforced, but it's a de
>> facto standard and some IDEs like PyDev gives you an error if you
>> declare a non-static method without `self` as first parameter)
> 
> Smalltalk and friends also use "self", so again, this would be the
> other common word for the parameter.

Out of the 23 languages listed by Wikipedia here:

https://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28object-oriented_programming%29#Special_variables

I see:

10 use "self"
10 use "this"
3 use "me"
1 uses "current"

(that adds to 24 because Xojo can use either self or me).

That's only a tiny sample of languages in the world. I expect that there
will be significantly more variation if you expand the list, but
that "self" and "this" will remain the two most popular choices.



[...]
>> * `True`, `False` and None instead of `true`, `false` and `none` (they
>> seems classes)
> 
> This one, I've no idea about. Why have "bool" as the type, and "True"
> and "False" as the instances? I think the built-in types have their
> names grandfathered in from when they were factory functions, but that
> doesn't explain the capitalized instances. (And the type of None is
> NoneType, just to confuse the matter further.)

Read the PEP:

https://www.python.org/dev/peps/pep-0285/

    3) Should the constants be called 'True' and 'False' (similar to
       None) or 'true' and 'false' (as in C++, Java and C99)?

    => True and False.

       Most reviewers agree that consistency within Python is more
       important than consistency with other languages.




>> I don't ask about `None` instead of `null` because I suppose here it's
>> a matter of disambiguation (null, in many languages, is not equal to
>> null).

On the same Wikipedia page as above, I count:

10 languages using "null"
7 using "nil"
1 each using
"initial", "void", "none", "nothing", "nullptr", "undef", "undefined"



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list