So I took /prog/'s advice and started learning python:
Here is my first ever program that is not copypasted from the tutorial. (I went further by not ONLY having it say 'too high' or 'too low' or 'you guessed it')
Am I doing it right or is declaring 5 variables a waste of time?
Why cant I just say
if a < 5:
print('way too low') #?
why does it have to be a variable?
Name:
Anonymous2009-03-11 20:02
Am I doing it right or is declaring 5 variables a waste of time?
Why cant I just say
if a < 5:
print('way too low') #?
why does it have to be a variable?
It doesn't have to be a variable if a < 5: should be fine
And if declaring them on five lines is too annoying you could do
number,smallnumber,bignumber,hugenumber,belownumber = 23,5,50,150,22
Whats so bad about forced indentation (indention)?
Nothing, it's just the only thing we've been able to fault python for, so we mention it at every available moment
>>8
They just stick with if elif elif .... else. I think there has been proposals but probably couldn't come up with anything pythonic enough for guido.
>>7
How about all the self() bullshit?
What about how retarded it is to save three characters and make the code less english like with elif instead of else if.
How about that it is slow as shit. Even ironpython is slow as shit.
How about that there exists no fully featured IDE for it?
Man thats 4 solid criticisms and I've never even coded in python. The only time I've coded in python was to help a friend with his programming homework(because expert programmers can easily program in any non super gay language).
>>15 How about all the self() bullshit?
I don't know what language you think you're talking about, but it's not Python.
What about how retarded it is to save three characters and make the code less english like with elif instead of else if. else: if: works just fine, if you're that confused by two-syllable keywords.
How about that it is slow as shit. Even ironpython is slow as shit.
It's an interpreted language. It compares very favorably to other scripting languages.
How about that there exists no fully featured IDE for it?
Vi and emacs are just as capable of editing Python code as they are any other language.
Man thats 4 solid criticisms and I've never even coded in python.
You don't say.
Name:
Anonymous2009-03-11 22:23
What about the distinction between statements and expressions?
How about the lack of distinction between variable assignment and variable binding? Forcing you to use shitty var[0] hacks etc.
How about the lack of several common control structures such as do..while loops, real for loops, multilevel break/continue, switches etc? Also the complete lack of ways to make your own control structures (no macros, no monads, nothing).1
How about the lack of proper tail calls?
How about Guido being a total retard?
1 At the ll2 workshop some python guy wanted to add a with syntax that automatically opens and closes handles, even in the presence of exceptions etc. A 10 second macro in any lisp, but the python guy needed a bunch of programmers hacking on CPython for a month to get it done.
>>17
Wah Python isn't exactly like Common Lisp. Only your last point has real merit.
Name:
Anonymous2009-03-11 22:30
It's an interpreted language.
It's only interpreted because of shitty implementations. lrn2futamura projections and read SICP.
One of the problems with python is that it's defined by CPython.
>>18
Python can be divided into two parts: the good parts and the original parts.
Name:
Anonymous2009-03-11 23:34
It compares very favorably to other scripting languages.
pretty much every other scripting language is faster.
the only scripting language it compares favorably to is ruby.
and with the way things are going (python getting slower and ruby getting faster), in about 10 years even ruby might be faster than python.
Name:
Anonymous2009-03-11 23:37
>>16
>How about all the self() bullshit?
>I don't know what language you think you're talking about, but it's not Python.
He was probably referring to things like:
class Name:
def __init__ (self):
self.x = 7
But that's ridiculously easy to understand, when you do:
foo = Name()
then
foo.x == 7
Name:
Anonymous2009-03-12 0:05
>>16
In Python, you have to declare "self" as a first parameter of all your methods.\
[quote]It's an interpreted language[/quote]
Doesn't change the fact that its slow as shit.
[quote]Vi and emacs are just as capable of editing Python code as they are any other language.[/quote]
*Rolls eyes* whatever makes you feel hardcore bro. Notepad is capable of editing python too.
>>22
Hey now, Vim (not Vi) and Emacs implemented a shitload of "IDE" features long before bloatware like Eclipse got popular. And they're still small and fast like your tight, tight anus
Name:
Anonymous2009-03-12 0:52
Nothing, it's just the only thing we've been able to fault python for, so we mention it at every available moment
How about the fact that variable types don't seem to exist in the python world?
He's probably one of those idiotic drones that keep calling Emacs and Vim 70's abandonware. But the latest stable version of Emacs was released in September 2008 and the latest stable release of Vim was released in August 2008. And Vim development is still very active, and Emacs won't go the way of the dodo even if RMS can't work on it anymore. Doesn't sound very "abandoned" to me.
Name:
Anonymous2009-03-12 1:00
>>28
Or probably, he thinks they're just updated versions of ed that have taken all this time to get even half of the bigs fuxed.
Name:
Anonymous2009-03-12 1:06
>>22
Yes, you declare "self" as the first parameter for (most) methods, but that allows you to reference them inside your function definitions and refer them to the actual outside variable.
note that:
class Name:
def __init__ (bill):
bill.x = 7
is also valid. "self" is just commonly used because it make sense. I don't see why any one would consider this stupid or in anyway a hassle. you might as well complain that __init__ has TWO underscores rather than 1.
As for speed:
yes, great. C is faster, WE KNOW. so don't use python to develop 3d engines. developing a small utility program which doesn't consume all your CPUs? who cares.
>>30
ok, write a python script that caculates 1000000! in less than 20 seconds.
Name:
Anonymous2009-03-12 1:31
>>31
I totally forgot about that! Though I don't know enough about the game to know whether that was an extraordinary feat or not. I am not an "expert programmer" (I don't even know how to do the bbcode or whatever to make it look all fancy).
>>45
both c and sepples versions are also fucking useless. lrn2<mp.h>.
and then try doing 1000000! that way.
Name:
Anonymous2009-03-12 5:19
Considering you would need larger than a 131072 bit variable to store 1,000,000!, I'm guessing you'll be storing the number in a string or something, which will be SLOW AS FUCK.