New answers tagged python-3.x
i is just the name of a variable, in this case an integer. Most programmers will use i for the outermost for loop when iterating through a list of numbers. What this loop is doing is creating a range from 0 to n (some number). Then it's looking at all the numbers in there, one at a time. In this case the loop is running pic_word() n times.
A bound method is just a Python object that stores self in one of its slots. Take a look at methodobject.c for the C implementation. In Python the slot is accessible via the __self__ attribute: >>> a = [1, 2, 3].append >>> a <built-in method append of list object at 0x103b39588> >>> a.__self__ [1, 2, 3]
An alternative that doesn't abuse python so much, is to put the following in your __init__.py from .main import * Its not quite the same as replacing the module, but I would suspect it will work in most cases. However, I would take the theory that you shouldn't do it. Pretending that your code is in the root of the alpha module when it is isn't just ...
Top 50 recent answers are included