|
From: Magnus L. H. <ml...@id...> - 2001-01-27 23:20:31
|
Hi! I was just browsing the documentation at jython.org, and I read about the convention with @sig in the docstring of functions. Since Python now (by version 2.1a) supports function attributes [1], I assume this will be included in future (2.1?) versions of Jython. In that case, wouldn't that be nice to have a .sig attribute (or even .signature, which gets my vote, or .__signature__ or something) instead of (or -- for backwards compatibility -- in addition to) the docstring convention (or, as some might call it, "hack" ;-)? At least it seems this is the sort of thing function attributes was made for... Example of use: def setExpression(self, e): # Do something... pass setExpression.signature = "public void setExpression(java.lang.String e)" (I'm sure it might be seen as a drawback that the signature must be set outside the function. I don't really feel it matters much...) ([1] http://www.amk.ca/python/2.1) -- Magnus Lie Hetland (magnus at hetland dot org) "Reality is what refuses to disappear when you stop believing in it" -- Philip K. Dick |