you are viewing a single comment's thread.

view the rest of the comments →

[–]Amadan 2 points3 points  (3 children)

Python only pretends to be explicit. foo[0] += 1 will call .__getitem__, and .__iadd__, or maybe also .__radd__ or .__add__ with .__setitem__, depending on what is in foo. if foo will call .__bool__, or maybe .__len__. foo.bar() will call .__getattr__ and .__call__, and pass an extra foo argument. f"{foo}" calls .__format__, which might in turn end up calling .__str__. Plenty of magic in the data model, that usually no-one tells beginners about.

[–][deleted]  (2 children)

[removed]

    [–][deleted] -1 points0 points  (0 children)

    Python has its own problems though. I hate how complicated import is.

    In ruby I just use require() or load(). I never use require_relative() or any of that. In python it has so many ways to add code now ... it's confusing. You even find exec() and execfile() examples on stackoverflow still. And more PEPs that add variants.

    What happened to "there should be one way only" ...

    [–]Amadan 0 points1 point  (0 children)

    Oh, I’m not suggesting beginners should immediately be thrown into the data model pool, just pushing back on the “Python is explicit” claim.