15 ms·
Python looks more and more foreign with each release. I'm not sure what happened after 3.3 but it seems like the whole philosophy of "pythonic", emphasizing sim
by voldacar 7y ago
Python looks more and more foreign with each release.
I'm not sure what happened after 3.3 but it seems like the whole philosophy of "pythonic", emphasizing simplicity, readability and "only one straightforward way to do it" is rapidly disappearing.
- sametmax 7y agoMost code still look like traditional Python. Just like meta programming or monkey patching, the new features are used sparingly by the community. Even the less controversial type hints are here on maybe 10 percent of the code out there. It's all about the culture. And Python culture has been protecting us from abuses for 20 years, while allowing to have cool toys. Besides, in that release (and even the previous one), appart from the walrus operator that I predict will be used with moderation, I don't see any alien looking stuff. This kind of evolution speed is quite conservative IMO. Whatever you do, there there always will be people complaining I guess. After all, I also hear all the time that Python doesn't change fast enough, or lack some black magic from functional languages.
- wyldfire 7y ago> Even the less controversial type hints are here on maybe 10 percent of the code out there. I think this metric is grossly overestimated. Or your scope for "out there" is considering some smaller subset of python code than what I'm imagining. I think the evolution of the language is a great thing and I like the idea of the type hints too. But I don't think most folks capitalize on this yet.
- sametmax 7y agoI mean 10% of new code for which type hints are a proper use case, so mostly libs, and targeting Python 3.5+. Of course, in a world of Python 2.7 still being a large code base and Python being used a lot for scripting, this will far from the truth for the entire ecosystem.
- Quekid5 7y agoThe idea that types are hostile to scripting sounds really weird to me. Turtle[0] in Haskell is absolutely amazing for scripting -- especially if you pair it with Stack (with its shebang support) -- and it is as strongly typed as Haskell. There is a bit of learning curve (because, well, it's not shell which is what most people are used to), and you do have to please the compiler before being able to run your script, but OTOH, you'll basically never have that "oops, I just deleted my working directory because I used a bad $VARIABLE" experience. [0] http://hackage.haskell.org/package/turtle http://hackage.haskell.org/package/turtle
- dudul 7y agoWhat's an example of black magic from functional languages?
- llukas 7y agoIf you complained more specifically it would be possible to discuss. For what was described in article I don't see anything "foreign". Python was always about increasing code readability and those improvements are aligning well with this philosophy.
- teddyh 7y ago“I've come up with a set of rules that describe our reactions to technologies: 1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works. 2. Anything that's invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. 3. Anything invented after you're thirty-five is against the natural order of things.” ― Douglas Adams, The Salmon of Doubt
- whatshisface 7y agoDoes that mean someone born in 2008 will think C++ is simple and elegant?
- philipov 7y agoNo, the claim is that it's ordinary and just part of the way the world works.
- golergka 7y agoGood point. I think it should be rephrased in basis of personal familiarity: people who learned C++ before they were 15 indeed think that it's simple and elegant.
- mianos 7y agoI am both a Python programmer and a C++ programmer. I have programmed professionally full time in one or the other for years at a time. I think C++ is now a much better language than when I learnt it first (cfront). In particular C++11 really fixed a lot of the memory issues with shared_ptr and std:: algorithms. It is a better language now if you are doing anything larger than then a program that takes more than a few weeks to write. On the other hand, I love python for everything else and some of the new stuff is great but making a new way to print strings over and over tells me some people have too much spare time or not enough real work to do. In my opinion formatting a string to print a debug statement should be as concise as possible whereas a lot of these fancier formatting systems are better suited to stuff that ends up staying for use by other people. Luckily there are ways to use ye olde printf style formatters in both for those times.
- JustSomeNobody 7y agoI see what you're saying, but I kinda like the gets ":=" operator.
- simondw 7y agoBut now there are two ways to do assignment. That's not very pythonic, is it?
- nneonneo 7y agoRegular = can only be used in statements. Walrus := can only be used in expressions. There's no overlap there. However, := does simplify certain expressions (like those nested if-else statements and the common "while chunk := read()" loop), which I think does justify its existence.
- txcwpalpha 7y agoThis honestly makes it seem more confusing to me. The fact that there is now an operator that can only be used in certain statements just makes things more confusing. And if there really is no overlap, then why wasn't the "=" operator just extended to also work in expressions? "while chunk = read()" seems like it makes just as much sense without adding the confusion of another operator.
- ericdevries 7y agoOne of the good things about not using the "=" operator is that you cannot accidentally turn a comparison into an assignment, a feature that is a common cause of errors in other languages that do support it. By adding a completely different character to the operator it is not very likely to cause bugs, compared to just forgetting to type that second =
- bluecalm 7y agoIs it really that common? I made this typo a few times in my life. It was corrected every time before the program actually run because the compiler warned me about it. I don't see how you can make this mistake if you're not aggressively trying (by turning off warnings for example).
- baq 7y agoi've been hearing this since 1.5 => 2.0 (list comprehensions), then 2.2 (new object model), 2.4 (decorators)... happy python programmer since 1.5, currently maintaining a code base in 3.7, happy about 3.8.
- runxel 7y agoThat's especially funny given how everybody screams "that's not pythonic!!1!" nowadays when somebody does _not_ use a list comprehension...
- spamizbad 7y agoI cut my teeth on 2.2-2.4 and remember getting my hand slapped when 2.4 landed and I used a decorator for the first time. It was to allow only certain HTTP verbs on a controller function. A pattern adopted by most Python web frameworks today.
- amedvednikov 7y agoI'm working on a language with a focus on simplicity and "only one way to do it": https://vlang.io https://vlang.io The development has been going quite well: https://github.com/vlang/v/blob/master/CHANGELOG.md https://github.com/vlang/v/blob/master/CHANGELOG.md
- jamesb93 7y agoThis is great! Thanks for your work. Can V be integrated into existing c++ projects? I work in audio and constantly working in c++ is tiring. I'd love to work in something like V and transpile down.
- amedvednikov 7y agoThanks! Absolutely. Calling V code is as simple as calling C (V can emit C).
- noname120 7y agoReally interesting. For the skeptics, this is not just a proof of concept. There is a real app made using this language: https://volt-app.com/ https://volt-app.com/
- hexane360 7y agoand the REPL only leaks 1MB [1] to compile and run a hello world program. 1: https://github.com/vlang/v/issues/514 https://github.com/vlang/v/issues/514
- amedvednikov 7y agoIt doesn't anymore. There are lots of issues that are being fixed. Strange nitpicking on alpha software.
- flavio81 7y ago>I'm working on a language with a focus on simplicity and "only one way to do it": If I wanted a language with "only one way to do it", i'd use Brainfuck. Which, btw, is very easy to learn, well documented, and the same source code runs on many, many platforms.
- nerdponx 7y agoCan you give an example of something like this happening to the language? IMO 3.6+ brought many positive additions to the language, which I also think are needed as its audience grows and its use cases expand accordingly. The walrus operator makes while loops easier to read, write and reason about. Type annotations were a necessary and IMO delightful addition to the language as people started writing bigger production code bases in Python. Data classes solve a lot of problems, although with the existence of the attrs library I'm not sure we needed them in the standard library as well. Async maybe was poorly designed, but I certainly wouldn't complain about its existence in the language. F strings are %-based interpolation done right, and the sooner the latter are relegated to "backward compatibility only" status the better. They are also more visually consistent with format strings. Positional-only arguments have always been in the language; now users can actually use this feature without writing C code. All of the stuff feels very Pythonic to me. Maybe I would have preferred "do/while" instead of the walrus but I'm not going to obsess over one operator. So what else is there to complain about? Dictionary comprehension? I don't see added complexity here, I see a few specific tools that make the language more expressive, and that you are free to ignore in your own projects if they aren't to your taste.
- ptx 7y agoWhat would "do/while" look like in Python? Since blocks don't have end markers (e.g. "end", "}", etc.) there's nowhere to put the while expression if you want the syntax to be consistent with the rest of the language.
- nerdponx 7y agoI envisioned it like "if/else" or "for/else" or "while/else", where a "do" block must be followed by a "while" block. x = 0 do: x += 1 while: x < 10
- toxik 7y agoThis completely contradicts the rest of Python grammar, and indeed many languages’ grammars. The consistent way would then be `while x < 10` but that too looks ridiculous. The issue is that you can’t have post-clause syntax in Python due to its infamous spacing-is-syntax idea.
- LaGrange 7y agoIn my experience, every technology focused on building a "simple" alternative to a long-established "complex" technology is doomed to discover exactly _why_ the other one became "complex." Also spawn at least five "simple" alternatives. Doesn't mean nothing good comes out of them, and if it's simplicity that motivates people then eh, I'll take it, but gosh darn the cycle is a bit grating by now.
- orhmeh09 7y agoCould you provide some examples? Without having had that experience, I’m having trouble picturing a concrete example that I would be sure is of the same kind.
- LaGrange 7y agoNginx is probably my fav of the surviving-and-thriving ones. It still remains very distinct from Apache, but calling it simpler would be a large stretch. Projects like qmail discovered the reason in a somewhat _harder_ manner. And yes, I'd argue Python is yet another case, as it grew _at least_ as complex as Perl.
- newen 7y agoHaha, what was that quote? Something like, any language is going to iterate towards a crappy version of lisp.
- tjalfi 7y agoGreenspun's Tenth Rule[0] Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. - Philip Greenspun [0] https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule
- aitchnyu 7y agoHow would you subvert Greenspun in large codebases without Common Lisp? I once used Drools the rules engine which used a dynamic scripting language on Java objects. Python could have replaced that language, with much better tooling, errors etc.
- pippy 7y agoThis is what happens when you lose a BDFL. While things become more "democratic", you lose the vision and start trying to make everyone happy.
- dlbucci 7y agoWell, there were 4 versions released since 3.3 that still had a BDFL, so I dunno if that's the issue, yet.
- mixmastamyk 7y agoWalrus operator is the direct result of the BDFL pushing it over significant objection.
- l0b0 7y agoMy first though was the same as the snarky sibling comment, but after reading TFA I realized these are all features I've used in other languages and detest. The walrus operator an complex string formatting are both character-pinching anti-maintainability features.
- Razengan 7y agoThe '*' and '/' in function parameter lists for positional/keyword arguments look particularly ugly and unintuitive to me. More magic symbols to memorize or look up.
- riffraff 7y agoI also cannot honestly think of a case where I want that behaviour. The "pow" example looks more like a case where the C side should be fixed.
- yxhuvud 7y agoOr where the method should be exposed into several different methods.
- masklinn 7y ago> I also cannot honestly think of a case where I want that behaviour. There's plenty of situations where a named argument does not help, and encoding it can only hurt. It makes little to no sense to name the first argument to `dict.update` for instance. Or the argument to `ord`. That, incidentally, is why Swift added support for positional-only parameters (though it has no concept of keyword-or-positional).
- riffraff 7y agoIt does not help but doesn't hurt enough to grant a special syntax to avoid it. Yes, it limits your ability to rename a local variable, but that seems minor.
- Razengan 7y ago> That, incidentally, is why Swift added support for positional-only parameters (though it has no concept of keyword-or-positional). Swift's syntax is a lot more intuitive and consistent: function(parameterWithImplicitlyRequiredLabel: Int, differentArgumentLabel internalParameterName: Int, _ parameterWithoutLabel: Int, variadicParameterWithLabel: Int...) which you would call as function(parameterWithImplicitlyRequiredLabel: 1, differentArgumentLabel: 2, 3, variadicParameterWithLabel: 4, 5, 6, 7) [0] https://docs.swift.org/swift-book/LanguageGuide/Functions.html#ID166 https://docs.swift.org/swift-book/LanguageGuide/Functions.ht...
- hetman 7y agoI'm someone who loves the new features even though I don't think they're "pythonic" in the classical meaning of this term. That makes me think that being pythonic at it's most base level is actually about making it easier to reason about your code... and on that count I have found most of the new features have really helped.
- tjpnz 7y agoI don't think that philosophy was ever truly embraced to begin with. If you want evidence of that try reading the standard library (the older the better) and then try running the code through a linter.
- jnwatson 7y agoBeyond the older-than-35 reason, I think a lot of folks are used to the rate of new features because there was a 5 year period where everyone was on 2.7 while the new stuff landed in 3.x, and 3.x wasn't ready for deployment. In reality, the 2.x releases had a lot of significant changes. Of the top of my head, context managers, a new OOP/multiple inheritance model, and division operator changes, and lots of new modules. It sucks that one's language is on the upgrade treadmill like everything else, but language design is hard, and we keep coming up with new cool things to put in it. I don't know about Python 3.8, but Python 3.7 is absolutely amazing. It is the result of 2 decades of slogging along, improving bit by bit, and I hope that continues.
- chc 7y agoThe idea that str.format produced simpler or more readable code than f-strings is contrary to the experience of most Python users I know. Similarly, the contortions we have to go through in order to work around the lack of assignment expressions are anything but readable. I do agree that Python is moving further and further away from the only-one-way-to-do-it ethos, but on the other hand, Python has always emphasized practicality over principles.
- unethical_ban 7y agoYou can write very Python2.7 looking code with Python3. I don't think many syntax changes/deprecations have occurred (I know some have).
- themeiguoren 7y agoYep, I did a 2to3 conversion recently and it got the whole project 95% of the way there. A 3to2 would be in theory almost as simple to do for most projects.