fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] how to hide a method that's not a command, and how to al


From: Jeff Forcier
Subject: Re: [Fab-user] how to hide a method that's not a command, and how to alias a command
Date: Wed, 10 Feb 2010 18:42:35 -0500

Hi Phlip,

On Wed, Feb 10, 2010 at 6:16 PM, Phlip <address@hidden> wrote:

> I can prefix them with _, such as def _find_changed_tests(), but if I
> forgot the prefix (or if Python handed me some overwhelming reason to
> not underbar the non-command method), how can I hide the method? Is
> there a code @decorator?

We're working on having a more flexible, alternative "opt-in" method
of declaring tasks -- see this ticket and its related ticket(s):

    http://code.fabfile.org/issues/show/76

So with that implemented you'd be able to explicitly say that
functions X Y and Z are tasks, and everything else is ignored,
underscore or no underscore.

Theoretically, an extension to this might also be able to help out
your other problem...

> So how could I call the command '_int', and then rename it so its
> command line argument is "int"?

...by having syntax like e.g. @task('foo'), so that you can forcibly
"rename" a task despite the wrapped function's actual name. However,
this isn't a guarantee, just an idea.

I personally think that when it comes to wanting to name things that
clash with Python builtins, you're better off finding an alternate
name. Certainly, having an actual Python variable name overwriting a
builtin is bad form regardless of whether or not it's causing problems
in your specific code at present :) and I wouldn't want to add extra
code to core solely to support such practices.

All that said -- having aliases (if not 'renaming') is something I
think would be generally useful, so I expect it will find its way in
eventually.

Best,
Jeff

-- 
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]