12
Xoka
4y

Anybody loves python? I don't know why, but the more I use python, the more I seem to hate it. Specially the poor naming of the functions are just horrible! specially when you've been following the #CleanCodePrinciple strictly.

Let me give some example:
What does even "len" or "str" mean normally? is it a variable or a function? can anybody imagine?
where as in Java or JavaScript it is array.length and anyValue.toString()
anybody can understand what these things are, whether a variable or a function.

in python some functions are like "dothisorthat" and some are "do_this_or_that" some are "doThisOrThat". I mean, why can't you just follow an unified rule?

and there's this fragmentation between python 2 and 3! whether in stackoverflow or in youtube/udemy, a lot of them used python 2 and some uses python 3. I mean, can't they have some BackworkSupports?

Comments
  • 8
    len means length, str means string.

    idk man seems simple to me

    But yes, the inconsistent naming is also annoying to me. It should always be snake_case.

    Also, fuck Python 2
  • 2
    @kescherRant yeah man! following an unified naming system would have been amazing
  • 10
    Pythons are adorable. They function as my little cuddle noodles. I really would like another ball python. ❤️

    Oh, that python. Yeah it's alright.
  • 1
    I hate it from the bottom of my heart. I don't know why you even would use it. What's it's advantage over js, java, c or anything else?
  • 1
    I can hijack MS products and automate shit, beyond that I don't normally use python.
  • 1
    Python's great, and there's not a good unified naming scheme in many languages.
  • 2
    I love everything about Python except for the syntactical whitespace.

    I use it a lot at work to automate or glue together a bunch of shit. Might deploy a web2py small application if I feel cute enough because shit like the admin interface and the alreadyhereforyouidiotstouse interface is a time saver.

    But naming convetions, afterthought feel of oop, and the horrible use of __penis__ definitely annoys me. And I can't for the life of me remember to self on class methods, even after years of use.

    I am meh about Python, but know it so well that I make due with my meh attitude towards it.
  • 2
    Py3 is _mostly_ compatible with Py2, except for some changes that couldn't be made without BC breaks - that's why it's called Python 3 rather than Python 2.8. The transition was long and painful, many people refused to adopt Py3 for various reasons. But now Py2 is officially dead, so things should be improving.
  • 1
    len() and str() doesn't bother me much, but syntax of for loop with indices does.
    I prefer for(i=0; i<n; i++) style rather than enumerate(). Since python doesn't support ++ I'm ready to replace ++ with +=

    And yes consistency of snake_case should be there. IT HAS TO BE FOLLOWED!
    Large codebases in python sucks if they are inconsistent and even with consistency it takes time to understand.
    If dunder methods are your weakness such as __call__ you will have hard time getting your head around OOP based codebases.
  • 1
    Oh another rant about naming conventions. Let's see who's right this time 😂

    It would be nice if there were a global way of doing it, but there isn't. Different strokes for different folks. As long as it doesn't give you a stroke in the process.
  • 3
    @lkjhgf253 The law of the internet: The last one to comment is always right
  • 0
    @alexbrooklyn indeed they are 👀
  • 0
    As far as I understand those books (Clean Code, Design Patterns) are aimed to be used with OOP languages.

    Python is not object oriented. It is rather a protocol based lang (somewhat similar to functional programming languages like C).
    Protocol based because of those __internal_function__() functions like __len__(), __str__() and so on.

    I also personally often struggle to name things in python. As far as i gather you use snake_case and ditch getters/setters in favor of properties.

    Python is often described as "glue" since thanks to a lot of system library wrappers, you can often interact better with OS libs than in most other langs.

    Also python is one of the langs that got popular not because it was hyped, has a lot of R&D invested, was named after another popular language (looking at you, JS!) or was a recommended and tightly integrated language for a given platform (e.g. C#).
    Python got steadily better. PEP by PEP (Python Enhancement Proposal).

    (Java also adopted PEPs as JEPs.)
  • 0
    @pxeger Nailed it man! I wish I could give you a #MedalOfHonor :D
  • 1
    Me when reading this thread
  • 2
    @pxeger if you created an account just for this single comment... Well done man, welcome here
  • 2
    @pxeger
    Concision leads to ambiguity. Also meat grinders lead to sausage.
  • 1
    You would know len and str if you knew any C
Add Comment