> Why not make it a function? > > function assignLimited(value, vmin, vmax): > value = max(vmin, value) > value = min(vmax, value) > return value > > > a = assignLimited(7, 0, 10) > > > Seems like it solves your problem relatively cleanly. > Note: I also removed min/max variables because they would mask the > built-in min/max functions. > > -Larry
Yes, the simple solution is often the best. Still, I'm going for object oriented solution because I want the value and it's limits to be kept together as I'll have many such values with different limits. Storing all the limits in caller namespace is not really an option. -- http://mail.python.org/mailman/listinfo/python-list