вторник, 23 февраля 2016 г.

Python script with Go lang extensions

Have a discussion with team about using C extensions in Python code. This is known thing, yeah. "Not sure about development/debugging speed", - I said. C language code known to be complex and not so easy to debug.

Go lang looks more native to the tasks we discussed - massive/multithreading workers with performance in mind. The idea about using Go lang extension is looks very attractive.

четверг, 11 февраля 2016 г.

Python double underscore

Refreshed in mind meaning of __double_underscored__ methods and variables in Python. They are not truly private. This names only name-mangled to be sure not collide with ancestors.

Quote from official docs:

Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped. This mangling is done without regard to the syntactic position of the identifier, so it can be used to define class-private instance and class variables, methods, variables stored in globals, and even variables stored in instances. private to this class on instances of other classes.
https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references 

воскресенье, 7 февраля 2016 г.