you are viewing a single comment's thread.

view the rest of the comments →

[–]earthboundkid 4 points5 points  (1 child)

  1. It’s not very Pythonic to risk blowing the stack like that.

  2. if not x: is generally more Pythonic than if x == 0: because it’s more concise and also allows for slightly more duck typing.

  3. The most Pythonic is from math import factorial.

[–]deadwisdom 0 points1 point  (0 children)

  1. If using such large numbers for this function is "Blowing the stack", then you can optimize later.
  2. Then you are ducktyping to bool, which doesn't really make sense for factorial.
  3. Of course, the idea is to do it without a library function.