Tagged Questions
13
votes
10answers
2k views
Preferring Python over C for Algorithmic Programming
I've been studying a bit of algorithms and have been looking at sites like SPOJ.pl TopCoder etc. I've seen that programmers prefer C or C++ usually for most algorithmic programming contests.
Now ...
12
votes
5answers
3k views
Is monkeypatching considered good programming practice?
I've been under impression, that monkeypatching is more in quick and dirty hack category, rather than standard, good programming practice. While I'd used from time to time to fix minor issues with 3rd ...
7
votes
3answers
475 views
how to programtically build a grid of interlocking but random sized squares
I want to create a two dimensional layout of rectangular shapes, a grid made up of random sized cubes. The cubed should fit together and have equal padding or margin (space between). Kind of like a ...
5
votes
3answers
2k views
Is it a better practice pre-initialize attributes in a class, or to add them along the way?
I'm sorry if this is a ABSOLUTELY sophomoric question, but I'm curious what the best practices are out there, and I can't seem to find a good answer on Google.
In Python, I usually use an empty class ...
3
votes
6answers
547 views
Is it a bad practice to write shell script with many if-else statment and for loops?
I am maintaing several data process shell scripts which are full of if-else statements and for loops . I try to make the scritps tidy and easy to debug.
When I read some suggestions about shell code ...
3
votes
3answers
163 views
conditional expressions, correct usage
I've recently become quite taken with conditional expressions in Python. Apparently some people consider it unpythonic and whether or not conditional/ternary expressions are even A Good Thing seems to ...
1
vote
2answers
436 views
How can I work on multiple programming languages at same time [duplicate]
It always happen to me that if I leave the stuff for 1-2 months I forget the stuff.
5 months back I had symfony project and I did that. At that time I was very much confident that I can do any ...
1
vote
1answer
157 views
Pythonic version of Java interfaces
I fully acknowledge that Python and Java are different programming languages and should be used differently. That said, "Program to an interface, not to an implementation" is good language-agnostic ...
0
votes
1answer
106 views
return Trivial booleans?
I am writing a simple piece of code. Its a function that allowed the user to withdraw some money. There are some restrictions to this though.
The user can't withdraw more than the given withdraw ...
0
votes
2answers
174 views
Python - only one return per method? [duplicate]
I'm trying to sort out whether this is just a personal preference thing or whether it's actually bad practice to do this one way or another. I did try to reference PEP8 first, and I did not see an ...
0
votes
1answer
128 views
What is the preferred object to store this type of data structure
I was in a conversation with someone who codes for me. He was frustrated with my approach to a particular problem. I am entirely self taught and very pragmatic - I am not a professional developer ...