Movatterモバイル変換


[0]ホーム

URL:


If you want X, you know where to find it (was Re: do...until wisdom needed...)

Douglas Alannessus at mit.edu
Sun Apr 22 15:52:23 EDT 2001


jepler at inetnebr.com (Jeff Epler) writes:> This particular example can be done with very nearly the same syntax in> standard Python---a dot instead of whitespace between let/set and the> variable in question.> >>> import letset, __main__; letset.setup(__main__)> >>> let.x = 3> >>> x> 3> >>> let.x = 4> Traceback (most recent call last):Thanks for the ideas.  I think my coworkers might kill me if Iprogrammed this way, though.How do I use this for local variables?  Like so?   import letset   class Locals: pass   def add10(x):      l = Locals()      letset.setup(l)         l.let.y = 10      return x + l.ySeems kind of cumbersome and slow and doesn't handle variable "x".|>oug


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp