On Thu, 12 Sep 2013 12:48:07 -0400
Jacob Peck <[email protected]> wrote:
> On 9/12/2013 12:44 PM, Terry Brown wrote:
> > Stupid typeless language :-)
> There are (hideously ugly) ways around that...
So at run time,
def executeScriptFromButton (self,b,buttonText,gnx):
you could have
if ( type(b), type(buttonText), type(gnx) ) != ( LeoButton, str, str
):
do_something()
but that's (a) too late, because it's the user's problem, not the
programmer's, and (b) not watertight anyway, if you swapped buttonText
and gnx, they're both str, so no catch there. Let's ignore (b),
although I know subtyping str could address that in a typed language.
Is that what you were thinking of, or is there something you can do
function annotations these days:
def executeScriptFromButton (self,b: LeoButton,buttonText: str,gnx: str):
? (http://www.python.org/dev/peps/pep-3107/)
Hmm, I guess that's Python 3 only, so not a solution yet, even if there
was something that enforced it - just wondering what you had in mind.
Cheers -Terry
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.