Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Wedge of Lime
Sep 4, 2003

I lack indie hair superpowers.

FrontLine posted:

I wrote this short program as a cheap excuse to mess around with Python a bit more (only started learning about a week ago) and to screw around with VIM. Just wondering if there's any stupid newbie mistakes I've made or things I should watch out for. Considering it's pretty short I think I'm safe but just to be sure...

After a quick once over (I've not tested the program) the first thing I noticed was the lack of input validation.

For example, when asked how many images I want to download I type 'five.' what happens?

Adbot
ADBOT LOVES YOU

Wedge of Lime
Sep 4, 2003

I lack indie hair superpowers.

trashmatic posted:

There is no excuse for a professor to be showing code like this in an intro class. The rest of the program is pretty bad, too, but drat.....

To be fair it does say in the code comments at the top

## 1st look at USAGE OF FUNCTIONS AND SUBROUTINES (THAT WE CREATE):
## FUNCTIONS WITH NO PASSAGE OF PARAMETERS
## (notice the parenthesis with no variables inside)

I can still remember attending required basic programming classes in python when I'd already taught myself C. In all seriousness some students *really* struggled with functions after writing simple python programs without them.

It wasn't until they'd grasped functions and parameter passing that the whole "don't use global variables" stuff was introduced.

Wedge of Lime
Sep 4, 2003

I lack indie hair superpowers.

deimos posted:

or you can browse django's source and grab SortedDict.

Though they're still having issues, I believe the ordering of dicts is what causes the following lovely bug (I believe):

http://code.djangoproject.com/ticket/4193

http://code.djangoproject.com/ticket/6374

  • Locked thread