'with' statement in python ?

Roman Suzi rnd at onego.ru
Tue Jun 26 11:03:48 EDT 2001


On Tue, 26 Jun 2001, Emile van Sebille wrote:

If you ask, "dirty"*150 hack is here:

def with(me, **args):
  me.__dict__.update(args)

class test:
    def __init__(self, ln, wd):
        with(self,
            ln = ln * 25.4, # keep in mm
            wd = wd * 25.4)
        with(self, area = ln * wd)

>How could this be sorted out?
>
>--
>
>Emile van Sebille
>emile at fenx.com

(Everybody else, please, do not flame me ;-)

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Tuesday, June 26, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "It is better to be brief than boring." _/





More information about the Python-list mailing list