8 ms·
Python seems to embrace more magic and other subtle visual cues than any other language. I am convinced it is only "beginner friendly" because of how much folk
by taeric 6y ago
Python seems to embrace more magic and other subtle visual cues than any other language. I am convinced it is only "beginner friendly" because of how much folks insist it is so.
- zitterbewegung 6y agoI have heard the opposite from my friends who interacted with people saying that the language is intimidating because its "a real programming language". But, to be fair deployment and package management of python is a mess when you try to scale up.
- dnautics 6y agoThat's also true of its "explicit is better than implicit" rule.
- kevin_thibedeau 6y agoPython has little magic in it. It's 3rd party libraries that do un-Pythonic things.
- kissgyorgy 6y ago> Python has little magic in it. LOL
- quietbritishjim 6y agoThe descriptor protocol is definitely magic! It normally doesn't matter that it's magic because most people don't need to interact with it. And it causes a very intuitive result in the part of the language that most people actually do interact with: that x = obj.foo; x() is the same as obj.foo() (not true in Javascript!). But that doesn't change the fact that method binding happens in a more complex way under the hood than you'd expect.
- coldtea 6y ago>I am convinced it is only "beginner friendly" because of how much folks insist it is so. Well, also because you can open a text editor and have a script with very straighforward code in 10 minutes...
- cortesoft 6y agoThere are quite a few languages that can do that... perl, ruby, bash
- svachalek 6y agoThis is an... interesting idea of "straightforward" in the case of bash and to a lesser degree, perl (although I hear perl 6 is nicer).
- tyingq 6y agoRaku is even more expressive, so if you're unhappy with Perl 5 for readability reasons, there no improvement there.
- rpastuszak 6y agoHow about node/es?
- lizmat 6y agoPlease note that Perl 6 has been renamed to Raku (https://raku.org https://raku.org using the #rakulang tag on social media). And yes, it is nicer :-)
- dragonwriter 6y agoPerl and Ruby have even more common use of “magic” than python.
- sitkack 6y agoAs a long time (97) user of Python who completed a couple katas in Ruby, Ruby has _regular_ magic, as in it is predictable. Python magic is adhoc.
- dragonwriter 6y agoAs a long time user of both Python and Ruby, Ruby has plenty of ad hoc magic, at least as much of Python, though it's likely you won't see that as much in whatever language you are less familiar with.
- FartyMcFarter 6y agoThe magic is friendlier to beginners than to intermediate/advanced programmers.
- Alex3917 6y agoYup. There are a lot of problems with Python, but you're not going to run into them for several years. If you're running into them right away then you're probably not a beginner.
- Izkata 6y agoI'm not so sure. A couple times I've shown WTFpython [0] to a co-worker, who after spending a bit of time skimming through it mentions that they finally understand a bug they had when they were learning python. And which entry it is is usually different between them. [0] https://github.com/satwikkansal/wtfpython https://github.com/satwikkansal/wtfpython
- endgame 6y agoI run straight into the zoo of packaging systems every time I try to do anything with python.
- piva00 6y agoHave you ever worked or seen Ruby? Python is quite straightforward, not like Go but I wouldn't say it's too much magic happening...
- alexbanks 6y agoGod, when I was in the Ruby world it felt like other engineers would always say things like "Just type < insert magic line of text > and it'll just do this for you". I hated it. I hated it so much.
- jrott 6y agoPython has a bunch of magic but it's mostly helpful for beginners it’s only when you start to do anything beyond simple scripts that it gets in the way.
- jefftk 6y agoI've used Python for so long that it's hard for me to see its flaws; what (aside from the behavior of import which we're discussing here) seems most worryingly "magical" to you?
- mehrdadn 6y agoOkay, here you go. Find (& explain) the bug in this class definition: class A(object): def __init__(self): self.x = 1
- saeranv 6y agoI admit I can't see anything wrong here. What's the bug?
- mehrdadn 6y agoThis should help: what should the following code output? class B(object): def __init__(self): self.y = 2 class C(A, B): pass print(C().y)
- vore 6y agoWhat's the issue with the original code snippet? This seems to be demonstrating the pitfalls of multiple inheritance which is super clunky in any language.
- mehrdadn 6y agoIt's missing a super().__init__() call. This code would've worked fine had that line been there. You would not encounter this issue in e.g. C++. It's strictly due to Python's idiosyncratic linearization of the inheritance hierarchy, which can make your sibling class (which you have no knowledge of) your superclass. (!!)
- vore 6y ago
- pyuser583 6y agoIt’s beginner friendly because of the magic and visuals. When dealing with beginners, a strict indents policy makes sense. Also the standard data model - makes tons of sense as a way to introduce to OOP.
- opportune 6y agoSelf is a little beginner-unfriendly if they have exposure to other OO languages. In fact the OO model in Python, aside from inheritance/polymorphism, IMO provides a rather uncompelling story for why you should use it other than just naked data structures, because its implementation is too close to a dict, and it doesn't offer you good compile time/type checks (or if it does, it's not readily apparent how to take advantage of them) which will lead a beginner to lots of AttributeError
- pyuser583 6y agoI saw a meme that was “what if everything was x” for each programming language. For Python it was “what I’d everything was a hash.”
- dralley 6y ago"self" was what made it finally click for me that methods are just functions that take a copy of the data structure they're operating on. Java's "this" is just kind of implicit magic in comparison, and it didn't accomplish the same understanding.
- pyuser583 6y agoYou should check out Go.
- booleandilemma 6y agoI’m pretty sure the only reason Python is popular at all is because Google pushed it so hard.
- DangitBobby 6y ago...what? I had no idea they were involved at all.
- Karunamon 6y agoRuby has it beat on magic, I think. Debugging a misbehaving Rails app is an experience it's hard to get in many other languages or frameworks...
- chipotle_coyote 6y agoRails pushes a lot of the "magic adjacent" features of Ruby very, very hard, which I'm not sure has entirely been to Ruby's benefit -- it's very often not just the first exposure someone has to Ruby, but the only exposure. It's not as bad as being introduced to PHP by WordPress, to be sure, but it's still going to color your opinion. I think Ruby's actually a very nice general-purpose scripting language; as much as I like Python in principle, I find myself reaching for Ruby more often.
- uryga 6y ago> It's not as bad as being introduced to PHP by WordPress i had to learn PHP to do WordPress stuff (after programming in other langs for many years). what's so bad about their usage of PHP? (off the top of my head: in WP's "everything happens in some hooked callback" model, debugging can be a pain, lots of messing with globals and gluing strings together)
- chipotle_coyote 6y agoYour "off the top of my head" would be the main ones I would have come up with, maybe not quite as fast as you did. :) WP is very much of its time in terms of PHP good (and bad) practice. (Also, WP's style guidance is super weird compared to, well, just about any other PHP style that I've ever seen anywhere, or that of any other C-style language, for that matter. I know that's subjective, but it's Just. So. Weird.)
- pansa2 6y ago> subtle visual cues Such as? The only thing that comes to mind is significant whitespace - but some other languages are much more sensitive to whitespace than Python.