Reasons Python Sucks
421–430 of 554 posts
Re: Reasons Python Sucks
#422Earlier quoted context omitted.
> `a.y() and do_x()` If you're happy to write it that way round, why not just use `if a.y(): do_x()`?
It's worth noting the second can't be used inline. I don't know the history, but it seems like that might be one of the reasons `x() if y()` isn't allowed in python. [x() if y()] if it existed, might carry an explicit else None. On the other hand [x() and y()] does something different when y() is falsey.
Maybe I misunderstood your context, but if not, conditional expressions do exist in Python:
$ python
Python 2.7.12 |Anaconda 4.2.0 (32-bit)| (default, Jun 29 2016, 11:42:13) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> 1 if 1 == 1 else 2
1
>>> 2 if 1 == 1 else 2
2
>>> ^Z
$ py -3
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 if 1 == 1 else 2
1
>>> 2 if 1 == 1 else 2
2
>>>
Using nested conditional expressions to classify characters:https://jugad2.blogspot.com/2017/04/using-nested-conditional...
Re: Reasons Python Sucks
#423Earlier quoted context omitted.
It's funny how far off the author was, because there are genuine things to complain about with python, though they may not be exclusive to python. I regularly wish python required some sort type indication for function parameters, because dealing with libraries that take complex objects as function parameters can be an absolute nightmare. I wish python had some equivalent to the switch statement that didn't involve w…
Indeed. My personal bugbear is lack of multiline lambdas. I use these all the freaking time in JS and it's infuriating that I can't in python. At the end of the day it's a minor complaint of course.
Re: Reasons Python Sucks
#424I agree with the OPs points but disagree with the degree to which the author has used them as a means to "hate" a language. I generally avoid Python too but saying you hate the language because of a bunch of contrivances mostly wrought from inexperience and holding too strongly to C like languages is poor form. Versions: Ok? Versioning and fragmentation is a hard problem. Backwards compatibility is a hard problem. Mo…
Nope, for reasons I've explained up thread. In the meantime I suggest this code:
from __future__ import bracesRe: Reasons Python Sucks
#425Earlier quoted context omitted.
Indeed. My personal bugbear is lack of multiline lambdas. I use these all the freaking time in JS and it's infuriating that I can't in python. At the end of the day it's a minor complaint of course.
Guido Van Rossum and the development team didn't want the language to be functional. There is very little functional support in Python in general, besides not supporting first class functions over multiple lines.
You are confusing “first-class functions” and “anonymous functions”, which are completely different things. Python functions are first-class, independent of length.
Re: Reasons Python Sucks
#426Yes, these are all valid points, and I laughed. Holding up javascript (npm anyone?) as some kind of counter example that proves python is bad may have held some un-intentional humor as well. Don't get me wrong, I love js but it seems to me like if you took these same 8 points and made them about javascript it would be 100 times more damning.
Heck, I am even willing to count this great article itself as a reason to love the python community even more. Someone who hates python so much must do so from a place of extreme love.
Re: Reasons Python Sucks
#427Earlier quoted context omitted.
Note how almost all languages you take as shiny examples of virtue post-date Python: they all learnt from it so much , particularly on things like the stdlib. Python’s stdlib was the gold standard for a long, long time (the “batteries included” slogan was effective for a reason - they really were!). This was not by accident - Guido and others have always had the utmost care for good developer experience out of the bo…
> This was not by accident - Guido and others have always had the utmost care for good developer experience out of the box. How many languages pack an editor ready to go? Or a way to install modules with a single command? Not even Java, with all its commercial might, ever achieved that - it barely got a REPL last year, which Python has had for what, 20 years now? The Java module experience is miles ahead of the Pytho…
You are seriously comparing Maven, a huge and over-complicated xml-based system that is not even installed by default and that people hate so much that there are umpteen alternatives (gradle etc), with `pip install -r requirements.txt` that works out of the box? I just can't even...
> Python still doesn't have anything [like Maven]
And I thank the Gods for that.
Re: Reasons Python Sucks
#428One more for the list, and my all-time most hated Python annoyance: No equivalent of Perl's "use strict vars". In other words... blah = 1 if foo: balh = 2 print blah ...doesn't let me know I've made a typo the way the equivalent Perl would: my $blah = 1; if ($foo) $balh = 2; print $blah; Which outputs the following even without "use strict vars": Name "main::balh" used only once: possible typo And if you turn that on…
Don't think it would hard to implement a warning, without need for strict, as python already spits various warnings when given non-optimal code.
Re: Reasons Python Sucks
#429Earlier quoted context omitted.
Came to a similar conclusion. I use Python a lot, and it certainly has its problems. However, the article's analysis doesn't even begin to scratch the surface of this topic in an informed manner. Instead, we're presented with paragraphs written by someone who can't read a stack trace: In [7]: def foo(): ...: print('foo') ...: print('bar') File " ", line 3 print('bar') ^ IndentationError: unexpected indent
Isn't that a strawman? Wouldn't a more apt example be: def foo(): nums = [...] sum = 0 for x in nums: print(x) sum += x I don't know python well, but it seems like there could be subtle issues with indentation that wouldn't cause a compiler error, but would cause the wrong output.
That snippet is an example of not understanding indentation-based scoping at all.
Re: Reasons Python Sucks
#430Not that I was expecting depth from a site called "hackerfactor" by a guy who wrote something like "open source sucks", but seriously, this middle school level "sass" (and about a popular practice at that) shouldn't be near tech writing.
Should have stopped reading there. On that note, this has way too many upvotes for such a misinformed, badly written, sophomoric piece.