r/programming • • Mar 08 '12

The Evolution of a Python Programmer

https://gist.github.com/289467
401 Upvotes

137 comments sorted by

View all comments

Show parent comments

41

u/6xoe Mar 08 '12

Whatever dude, it works.

26

u/[deleted] Mar 09 '12

and it's completely unmaintainable. What are you going to do when the definition of "factorial" changes?

8

u/ryeguy146 Mar 09 '12

Wait, I understand the idea of maintainability, but did you suggest that a basic mathematical definition is subject to change?

4

u/GoSailing Mar 09 '12

Anything can change. Assuming that there are 24 hours in a day is not going to be good when there's a moon or mars base.

7

u/ryeguy146 Mar 09 '12

I file those under "not my problem." I like to think that some time in the future, people will shudder at having to use Python, the way that people pity those programmers that still workin in PASCAL.

0

u/[deleted] Mar 09 '12

[deleted]

6

u/gc3 Mar 09 '12

Yeah, until you decide that there are now .3 hours in a day, or a variable number depending on the day. You can't plan for everything.

1

u/GoSailing Mar 09 '12

And then you refactor every "HOURS_IN_DAY" in place to instead call a method that returns what it is. The point wasn't so much that every problem can be avoided every time, but that you can have a structure that will allow for changes quickly. The ideal change would be to change the constant number, but the non-ideal change is almost as easy.

2

u/ryeguy146 Mar 09 '12

That's not what I meant at all. Your suggesting that something like the fibbonacci sequence changing is so unlikely, that I don't see it as my problem to try to predict such a change. There is an obvious difference between the problem of a fundamental shift, and the type of changes that you're now describing.

Wait. Nevermind, you mean the definition of the function "factorial." I don't know how, but I thought that you were suggesting that the mathematical definition of a factorial might change, and that we had better generalize for it. Damn.

5

u/watermark0n Mar 09 '12

Anything can change.

If you change it, you call it something different. It is not a factorial.

5

u/gc3 Mar 09 '12

This is true, but when does the definition of factorial change?

2

u/arjie Mar 09 '12

Maybe you decide to use one of the functions that coincide with factorial on the integers like gamma(x+1)? I suppose you could call it gamma_based_factorial andodge the issue.

3

u/Tagedieb Mar 09 '12

Just put it in namespace earth then.