Python reading through descriptive naming

I have been using Python for about a year based on the main Java background. I found that Python is fairly easy to learn, as it focuses on readability and simple design. What I don't understand about python is why for a language that focuses so much on readability, it often uses very non-descriptive names for modules, functions, constants, etc. One thing I like about Java is its very descriptive class / attribute / method names (I like objective-C even more for this reason). It seems that python programmers generally seem to have taken a C-type approach to naming, where they use as short names as possible for everything. I know that everyone wants to do as little as possible, but I like that many programmers spend most of their time reading code and not writing it,so I find a choice between short non descriptive names and long descriptive names, to do. (I like the longer descriptive names xD)

A few examples, just looking at some modules in the standard library,

  • sched - event planner. Could this be an EventScheduler?
  • asyncore - Asynchronous socket handler, AsynchronousSocketHandler?
  • imghdr - Determine image type, Define ImageType?
  • Brine?

I know this is not a huge problem, but I find myself more often than not looking for the meaning of any new (or forgotten) module that I come across when in other languages, such as objective-C or Java, I can get this value directly from the definition of modules / functions / attributes. On the other hand, people tend to write code similar to the way they write the standard library, so you can be sure that if the standard library uses non-descriptive names, the average developer will use even more non-descriptive names.

, - , ?

+3
2

, , , Python , Java ( , ;-)). , , Python , (Java) , (* cough * Perl).

, , , str, AsciiString UnicodeString (Python2/3 ). , urllib.urlencode random.normalvariate, .

(, , ). , " ", , , do_something_with_type_a. , , .

itertools? , . (chain, cycle, repeat), (islice, izip). , , , "zipping" "slicing", , Python.

sched/asyncore/imghdr: , , , , . , , .

pickle: , , . "", , .

+2

PEP 8

:

CapWords. .

, , , .

Zen of Python. , AFAIK , , , Python - .

0

Source: https://habr.com/ru/post/1781269/


All Articles