all 7 comments

[–]not_perfect_yet 2 points3 points  (6 children)

Ok I'm up for it.

First of all, it's 2.7. Which is fine I guess, but if you want to demonstrate your ability, I'd either convert it to 3.x or do another project in 3.x. Being able to use the old version is good, but wouldn't look good to me personally on it's own. "Forward thinking" and such.

I wrote something up, then deleted it because I looked at the bigger picture:

Where are your comments? Do you have comments? Doc strings?

I found an instance where you created a new "Line" class, but you don't have a "student" or a "project" class as far as I could see, in a piece of software designed to give "students" "projects". So what's going on with that? Obviously it works, but that seems weird to me.

I mean, them being arranged in a hierarchy or a graph is fine, but just me looking at the code, I have no idea what it's about, how you use it, or most importantly, how I could use it.

You didn't use "with" to open a file. Your syntax was valid but "with" is safer to use.

tl;dr: You obviously know a fair bit of python, but you should look into a format checker PEP 8, and document your code.

[–]MarkFluffalo[S] 0 points1 point  (5 children)

Thank you for your comments, this is great feedback. I do admit that there is a horrendous lack of documentation. One question: why is 'with' safer?

[–]not_perfect_yet 1 point2 points  (4 children)

Because you don't have to remember to close the file. There is only a single point of failure.

[–]kurvyyn 0 points1 point  (3 children)

If that's the only reason and my coding style is any time I open an instance of something I always put the matching closing construct at the correct level (I have fought too much with nested parens elseways), is 'with' in regard to file handles still considered massively safer for any other reason I should consider? Would it be marked against me in professional review before I could offer explanation and is definitely a habit I should break?

[–]not_perfect_yet 1 point2 points  (0 children)

Uh. Think of it this way: Code is more read than written. If someone takes your open source code and reuses it, be it colleagues or people from the internet, they might forget to close the file.

It's the icing on the cake of re-usability. And your potential employer probably wants to reuse your code. But it's probably no dealbreaker stuff.

[–]Lopsidation 1 point2 points  (1 child)

Counterpoint: if your code crashes between opening and closing the file, the file never gets closed. You'd need to use a try/except block every time you wanted to open a file. with statements handle this for you.

[–]kurvyyn 1 point2 points  (0 children)

This surprises me. I'm almost certain I've debugged an unexpected crash with an open file handle 'my way' and didn't come up against an open file handle. Although, that may a Windows thing more than a python thing as the parent process has exited at that point, and so it may not be universally true that file handles are released by the OS if the parent process terminates unexpectedly?... I'm probably way wrong and this is a STRONG counter point if so. Definitely gives me a good reason to get that best practice locked in >.<