PDA

View Full Version : PSA: Never Code in Python Programming Language



mindlessdrone1991
06-01-2011, 11:35 PM
As the thread title suggests, I am here to urge anyone who will ever write even a single computer program ever in their lives to avoid using Python at all costs.

Why might someone use Python? Because it seems sooo much easier than C++ when you start out. No semi-colons or squiggly braces or >> signs. It sucks you in with promises of rainbows and happiness....

Then you write a code that has to produce a lot of output - which causes you to deteriorate into a weeping infant, assuming the fetal position and cursing whomever decided that a 10% reduction in the time required to write a program was worth the trade-off of running 100 times more slowly.

So, do yourself a favor, and never, ever, EVER code ANYTHING in Python. It will only end in heartbreak.

Ystradmynach
06-01-2011, 11:46 PM
Huh, that makes me feel less guilty about never learning Python. It still has to better than coding anything in Scheme though.

PurdueDave
06-01-2011, 11:50 PM
lol

Duly noted.

mindlessdrone1991
06-01-2011, 11:52 PM
I dunno. I only know Python and C++.

I actually learned a bit of Python (mostly the visual module) before learning C++, and Python just seemed so much easier to work with (it's not really, just ever so slightly faster to write programs; and certain mathematical quantities are easier to express - e.g., it actually has a good value for pi, whereas my C++ professor had us do 4*atan(1) ).

There are some minor-moderate advantages to Python, but when I have to output 100,000 values at a time, I end up staying awake until 1 AM hating myself. :)

fuzzy1guy
06-01-2011, 11:55 PM
Nah. python is fine. for simple things.

ie. one step above just a plain script.

If you can't whip it out in python completely in about 2 hours. Don't use python for it. :D

mindlessdrone1991
06-02-2011, 12:02 AM
Nah. python is fine. for simple things.

ie. one step above just a plain script.

If you can't whip it out in python completely in about 2 hours. Don't use python for it. :D

Don't listen to this guy! That's just what they want you to think! Then you get addicted to your semi-colon-less lifestyle, and then the downward spiral begins! :O

In all seriousness though: for simple tasks, Python. For lot's of output, avoid Python at all costs. If you swear you hear your laptop mocking you, that's (probably) just sleep deprivation because you didn't follow the aforementioned guidelines and you're still awake waiting for your program to finish running.

protokon
06-02-2011, 12:04 AM
Java ftw. as much as I hate to admit it :(

sacredguyver
06-02-2011, 12:13 AM
http://imgs.xkcd.com/comics/python.png

This

bigolbear
06-02-2011, 12:17 AM
one simple little word my good fellow.

LISP.

recursion: its hell within hell within hell within hell within hell within hell.....

caberonia
06-02-2011, 12:25 AM
TBH.. i tried to learn python for civ IV modding.. and found it more difficult than C++ personally. IMHO your better off learning a C based language than even messing with python.

Cardtrick
06-02-2011, 12:30 AM
I think you're doing it wrong.

Python's fast enough for virtually anything except truly high-performance software (real-time stock trading, some scientific computing, cutting-edge 3D games, etc.). If you're running into problems with its speed, there's very likely a faster way to do whatever you're trying to do. That may mean a better algorithm (maybe you're doing it in n^2 but there's a way to do it in nlogn, etc.) or it may mean a better technique (caching, concatenating strings before outputting, having I/O in a separate thread, etc.).

And if worse comes to worst, profile your application to find out what's taking up the biggest chunk of time (likely a nested loop somewhere with significant calculation or I/O in the inner loop) and rewrite just the inner loop in C. Python has great C-interop.

mindlessdrone1991
06-02-2011, 12:37 AM
some scientific computing

1. Attempt to model chaotic system in Python.
2. Weep openly.

:p

But thanks for the other advice. I'm still a newb to programming, so I'm likely not writing my programs as efficiently as I could/should.

Patsaan
06-02-2011, 01:01 AM
I think you're doing it wrong.

Python's fast enough for virtually anything except truly high-performance software (real-time stock trading, some scientific computing, cutting-edge 3D games, etc.). If you're running into problems with its speed, there's very likely a faster way to do whatever you're trying to do. That may mean a better algorithm (maybe you're doing it in n^2 but there's a way to do it in nlogn, etc.) or it may mean a better technique (caching, concatenating strings before outputting, having I/O in a separate thread, etc.).

And if worse comes to worst, profile your application to find out what's taking up the biggest chunk of time (likely a nested loop somewhere with significant calculation or I/O in the inner loop) and rewrite just the inner loop in C. Python has great C-interop.

Just wanted to say, that there are games and applications written with python that work extremely well - ever heard of EVE online for example - it uses python. Many linux applications (like Amarok) use python. I think the python vs c speed comparison is not important/relevant to anybody else than the ones who write the applications and actually test those millisecond/second differences. For every computer user - if they see that application is slow - they get more powerful computer and thats it.

protokon
06-02-2011, 01:16 AM
one simple little word my good fellow.

LISP.

recursion: its hell within hell within hell within hell within hell within hell.....

LISP = lost in stupid parenthesis :D

sirgog
06-02-2011, 01:34 AM
HISSSSSSSSSSSSSS....

Oh wait, not that Python?

fuzzy1guy
06-02-2011, 07:25 AM
Real programmers do it all in asm!
:eek:

Truga
06-02-2011, 07:34 AM
Nah. python is fine. for simple things.

I beg to differ:
http://www.google.com/
http://www.eveonline.com/
Two very complex things, that both would not exist without python.

I do most of my work in python. It works fine for everything (except threaded heavy computing). Anyone telling you anything else is lying.

Edit: Also civilization 4.

Yaga_Nub
06-02-2011, 07:55 AM
Python is so 2000ish. All the cool kids program in YAGA now.

Ravoc-DDO
06-02-2011, 08:00 AM
EVE online is written in Stackless Python.

Nospheratus
06-02-2011, 08:05 AM
I beg to differ:
http://www.google.com/
http://www.eveonline.com/
Two very complex things, that both would not exist without python.

Yes they would...

Cyr
06-02-2011, 08:08 AM
I like python myself.

I use it for test scripts and other on the fly engineering uses. For that it really is ideal.

That said I would not use it to code anything complicated as I prefer other languages for those tasks.

krogyy
06-02-2011, 08:16 AM
also facebook was developed in Python afaik


I think you're doing it wrong.

Python's fast enough for virtually anything except truly high-performance software (real-time stock trading, some scientific computing, cutting-edge 3D games, etc.)

last i heard Python was close to be the de-facto language for stock trading... but i may remember wrong.



And if worse comes to worst, profile your application to find out what's taking up the biggest chunk of time (likely a nested loop somewhere with significant calculation or I/O in the inner loop) and rewrite just the inner loop in C. Python has great C-interop.

this. write the heavy stuff in C and the rest in Python to optimize development time.

joueur
06-02-2011, 08:31 AM
I know a Python programmer, he's an old man with lung cancer (smoker).

Truga
06-02-2011, 09:20 AM
Yes they would...
CCP's commercial success today is built on the single decision of selecting Stackless Python as our foundation.
-- Hilmar Veigar Petursson, CEO of CCP Games.

I'm sure I read something similar about google way back when.