osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Old Man Yells At Cloud


On Sun, 17 Sep 2017 04:00 am, Stefan Ram wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:
>>"Hi, I've been programming in Python for what seems like days now, and here's
>>all the things that you guys are doing wrong.
> 
>   I never ever have written a line of Python 2. I started with
>   Python 3.6.0. Yet a very frequent mistake of mine is the
>   imission of parentheses after ?print?.

That's remarkable.

Do you also forget the parentheses around `len`, and `iter`, and `math.sin()`?
If not, what's so special about print?

Javascript (at least the Rhino interpreter, if not others) includes a print
function. It too requires parentheses:

js> print 21
js: "<stdin>", line 5: missing ; before statement
js: print 21
js: .......^
js> print(21)
21


>   WRT my other common errors, It thought of writing
>   a program that autocorrects my source code as follows:
[...]
>   Whenever the next line is indented more, add "def" to
>   what looks like a call (and does not start with ?class?
>   or ?def?;
> 
> f( x ):
>     return x * x

Seriously Stefan, forgetting colons is one thing, but if you regularly forget to
start function definitions with "def", I fear that you're just not paying
attention to what you are doing.

Do you occasionally find yourself halfway down the street after leaving home
when you realise you're not wearing any pants? :-)



-- 
Steve
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.