const pi = 3.17
print pi
print (numpy.pi)
the standard rules of precedence
Whoever invented it was an evil man, who wanted to create the single largest collection of mistakes in any programming language. It's evil and unnesesaey.
but , he was the dictator for life. So , what's the issue. he dictates. it's his language !
Maybe there was a rebellion?
It just became so big, because people actually are using it.
As a casual user trying to replicate others' python based projects my understanding is python perhaps is good for Right Now and Today type of projects. It is absolute nightmare however trying doing anything from some time ago because of python's poor back compatibility and because project authors rarely if any time at all specify which version of python they used. More than once i wasted time trying to run "just use python" type of projects to only realize the project used one of previous python versions. Guido himself said python versions non-compatibility was intentional. Hows that can be good is beyond me.
They painted themselves into a corner. With exceptions like the print statement. And 3/2=2. It had a bunch of nonsense result, it had to die. Only reason they keep it alive, because there are a bunch of server backend already running on 2.7. I think it is more annoying that it doesnt have python38.exe python27.exe, and the installation folder keeps jumpring around in windoes. I think it is somewhere in the appdata folder now.
Explicit type declarations for much code (small projects, test code, personal code and many others) is kind of like a forced check to make sure your shoelaces are tied. A good thing, and very important for those new to tying shoelaces. And would prevent some accidents in even the most experienced shoelace users. But with real irritation value and real costs associated. If it is code with safety of life consequences it is definitely worth it. In other cases not so much. A smart enough compiler could flag instances where the shoelaces seemed to be untied.
semi-Agree. Then can we at least have upward expansion for free ? if there is no risk of loss of data : convert. And can we make a smart IDE that underlines conversions that can go bad ? if, during the coding step you do
int x
float a,b
x = a/b : put a red squiggle under X. hover mouse and it says : warning : converting float to integer
int x,a,b
x = a/b : red squiggle
x = a\b : no squiggle. this is integer division
That would help a lot. These checks should be easy to implement in visual studio.
No, they shouldnt do this. This is working code in python:
def mul(a,b):
return a*b
mul(1,2)
mul(1.51212,2)
mul(numpy.array([[1, 2], [4, 5]]),numpy.array([[7, 8], [9, 10]]))
Yes the same function will multiply matrices if you want to. Once you really learn the language, it feels like C is checkers, and Python is "5d chess with multiverse time travel"
I'm seeing this with many people who are new for python, and worked with C for a long time. They have problems, like how to run indexes on lists in for loop. And when I see their code, I can rewrite the entire 5+ line code into a list comprehension.
Honestly, the entire walrus operator fight was nonsense. I mean, I understand, that it is his language, but what we are writing is our code. Nothing forces them to use the operator. Dont like it, dont use it.