Blog of


Acronym is EVIL

I really enjoy all my experience in python-coding because I find it very readable and transparent.
Yes we're math guys, but honestly 80% of our time is dedicated to one single process:
BECAME UNDERSTANDABLE by theses f***ing stupid machines.

Python is really great for that, re-usability, factoring stuff,
building framework, and all your applications can be read like a book.
BUT, and I mean it, all theses efforts are useless if we are fuzzy, imprecise or the worst of it: concise.
I'm pretty sure that nobody will advice to call a variable "a, b , toto", but better to stick to "currentRootJoint", right ?

So why I see sooooo many acronyms along the internet snippets ? Around templates or also in python mechanics ? (Cf my APyTA post on python referencing)
Python does not recommend using import *, to avoid collapsing names.
We're writing to machines, who only recognize keywords, so please do NOT complicates things and shorcut your code.

Yes, "pmc"  is shorter that "pymel.modeling.core" but do you well remember it ? One year later ?
How can you be sure that you will not require an external module, in a distant future, who will have pmc as acronyms  too?
You have "dof" everywhere for your "degree of freedom" in your character-rigging tollkit,
and six month later, you are dealing with rendering and "depth of field", so.... "dof" also ? Is this readable really ?
Same thing in c# and Unity3d, for Random for example (Do you mean UnityEngine.Random  or  System.Random ?)

Therefore, I strictly forbid any acronyms in my personal naming convention. And I mean it.
So yes, my code is wider. But I was taught to not make functions too high, not too large !
We code now on the same workstation that infographists, so 24inches is not an issue at all !

Long import, long call of function (I always write pymel.core.modeling.polyCube() , but like that I am precise. I know where I come from (notion of namespace like in c#).
And when I am dealing with my own framework (which is multi-contextual, and manage several workflows, as Mobu;Maya, etc., with an external asset manager), I really need this "full package path".

On top of that, when you are tinying your names (function, var, import) you just keeping your knowledge for yourself.
(And for the yourself of 'right now'). That's selfish.
A future reader, coming from a non-CGI world, would most probably do not understand you. From the "not so different math-world" there is many ways of splitting our point of view (like the Y-axis definition)...
I know that I 'm quite alone on this fight, and my coding style appears weird or preposterous, and are not like all others API, but I kept this philosophy which suits me.

Comments (2) Trackbacks (0)
  1. well, i read your post and makes me feel that you are really angry at those who use ACRONYM , I have never used import * (since i understand the problem and since also read in python docs), however I have been using acroym like open for maya.OpenMaya , but after reading your this post I would try to write code with full line of import just as u mentioned. However I would like to know from you, what is standard line length has to do or dealt with while coding in python? is sticking to standard line length pythonic or writing full lenght module name like pymel.core.modeling.polyCube() pythonic ?

    the second thing I want to know is your opinion on usage of list comprehension? Its usage is contradictory to itself, many programmers have suggested me, not to use it, for better code readability so others can also understand and I guess you prefer code readability too but some programmers have suggested to use it and also felt encouraged after reading in Expert Python Programming by PACKT Pub..

    Looking forward in hearing from you!!!

  2. First, Thanks you a lot for reading me ! That means a lot for me^^.

    Well, when I did mention the “length of a line” aspect of the acronym issues, It was just thinking about the old times, when we coded in CRT Monitors with a 4/3 ratio of a wiiiiide definition of 800×600 pixels^^.
    In that period shorcuts were almost mandatory !
    I’m not really an expert to that “pythonic” adjective, but I think my full verbose mode is not very pythonic, and pure pythoner uses alias “as” a lot when importing. BUT.
    Being pythonic is also for me a question of readability, because pythonic syntaxes are also not very non-python-users friendly.
    Take CGI studios, where a lot of people code in MEL, they could not understand “lambda” for example.
    Being pythonic is great; it is smooth, it is pure,and elegant…. but for pythoners.
    A developer told me one day he hates python because its syntax was build on the concept of “not look like c++”, and I agree, its “original” syntax is dumb sometimes. Take comments with # as an example^^.

    Every evening I switch back to my PHD research done in c#, and It really bothers me when I mixed both syntaxes !

    I ‘m not sure I understand well your second question, why List usage are contradictory ?
    a “” iterator is quick and clear for me and others, (and this time has its foreach equivalent in c#).
    I will read your book reference with attention^^.
    I don’t think Append could be a misunderstood keyword (maybe extend, but I use it rarely).

    To be honest, being able to start to understand how python works, I’ve notice that I use more and more dictionaries, and I will wrote a Blog Post about that (hey hey, stay tuned^^).
    Because that how python works, tagging variable with tags in hashtable, and Garbage collector deleting from RAM a non-tagged space.

    To conclude, I built a python CGI-Oriented framework, with both Maya AND Mobu environments with the very same code, and the “acronym dodge” was very helpful to avoid conflicts in that particular case.

Leave a comment

No trackbacks yet.