9
beriba
8y

I spent the whole day coding in python (usually I code in php or perl) and this language is a fucking joke. C'mon, why everything have to be done in such a weird way? And don't say it's python way because it's bullshit way. Want some examples?

", ". join(str(x) for x in array)
to join array of integers. wtf is that?

True|False
why in hell you need the first letter to be uppercase when your own fucking standard says to use lowercase letters in eg. var names and method names. why?

math.isnan(float(x))
to check if a variable (expected to be integer) is NaN. I won't fucking comment that...

Even prolog don't have such stupid things

Comments
  • 9
    First one works the same way in pretty much all modern languages with scalar objects (join is a method in the string class, strong typing means you have to explicitly convert your objects to strings before you can pass them to join and a list comprehension is the easiest way to do it (you could use map instead if you want ','.join(map(str, array))

    True and False are not variables, they are constants, all built in constants use CamelCase, treating True and False differently would be inconsistent.

    as for the NaN check, it isn't that different from PHPs is_nan($x), if the value is expected to be an integer you should check if it is an integer rather than if its not NaN.

    NaN is a non computable floating point value with the special property NaN != NaN (Which incidentally makes it fairly easy to check if a value is NaN without using a special function for it , if x != x is True then x is probably NaN)
  • 1
    Patience is your fellow, get used to these minor syntactic changes and you'll love what lies behind
  • 2
    whenever I code in python, I do some perl to clean myself afterwards 😛
    same goes for php
  • 1
    @ItsNotMyFault join function is fine but why invoking it on the "glue"? it's completely irrational. it should be something like array.join(glue) or join(array, glue) or even string.join(array,glue) if you want that function in string module.
    Why booleans are constants? Most modern languages have them built-in. And if this is a constant what happens if you override it? I believe it's evil
    isnan function itself is fine. Even it's placement in math module looks good. But why I need to cast it to float? Because someone represented NaN (which states for Not a Number!) as a special float with irrational property? Wow, that looks consistent
  • 1
    @beriba regarding the join, because you join the array elements and not the glue
    Regarding the nan, in javascript NaN is a float since any "number" (of the number type) is float. This is very inefficient since integer calculation is much faster. Probably most use cases of NaN are in numeric analysis which is all about flops. I'd count that as a valid reason
  • 0
    @beriba NaN is defined by the IEEE 754 floating point standard, integers, strings, random objects, etc can't be NaN.
Add Comment