state machine and a global variable
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Fri Dec 14 19:50:35 EST 2007
On Fri, 14 Dec 2007 23:06:28 +0100, Bruno Desthuilliers wrote:
> Now the question is: why do you think it's so important for your users
> to only see functions ? What's so wrong with:
>
> from state_machine import *
> m = get_state_machine()
> m.set_state(42)
I can't speak for the "only" part, but it is sometimes really convenient
to have a set of *cough* convenience functions that do the simple stuff
for you. For example:
import random
random.random()
is much nicer for the simple cases than:
import random
prng = random.Random()
prng.random()
with the advantage that you can still instantiate your own instance if
you need/want to.
--
Steven.
More information about the Python-list
mailing list