Movatterモバイル変換
[0]ホーム
Deprecate self
Harry Georgehgg9140 at cola.ca.boeing.com
Wed Apr 18 12:09:29 EDT 2001
In Modula-3, I think "self" is not reserved -- you can use other namesfor the first arg. Further, you can call the method as a standalonefunction or procedure as long as you supply the arg directly. I do(did) this regularly in Modula-3 in conjunction with partialrevelation. It even seems to work in python: #method signature: def from_tadef(self,fileobj,style="tadef") #usage: t=Tadef_File() #---method calls--- t.from_tadef(filename) t.to_tadef(filename+".out") #---function calls--- Tadef_File.from_tadef(t,filename) Tadef_File.to_tadef(t,filename+".out")Obviously, in the standalone mode, you cannot rely on an implied"self" -- it is just another argument.piet at cs.uu.nl writes:> >>>>> "Alex Martelli" <aleaxit at yahoo.com> (AM) writes:>> AM> "Dave LeBlanc" <whisper at oz.net> wrote in message> AM> news:9bji5k$417$0 at 216.39.170.247...> >> Since self is used for every method of every class, isn't it a bit> >> redundant?>> AM> Not really. Explicit is better than implicit.>> >> I don't know of another OO language that makes you manually> >> carry around the "this"/"self" pointer/reference...>> AM> Modula-3, for example (I believe 'self' is a reserved word> AM> there; in Python, it's "just" a 'universal' convention).>> And Corbascript/IDLscript, which heavily borrowed concepts from Python> --> Piet van Oostrum <piet at cs.uu.nl>> URL:http://www.cs.uu.nl/~piet [PGP]> Private email:P.van.Oostrum at hccnet.nl-- Harry George E-mail:harry.g.george at boeing.comThe Boeing Company Renton: (425) 237-6915P. O. Box 3707 02-CA Everett: (425) 266-3868Seattle, WA 98124-2207 Page: (425) 631-8803
More information about the Python-listmailing list
[8]ページ先頭