[IPython-dev] Should we disable autocall by default from now on?
asmeurer at gmail.com
Wed Nov 30 14:45:03 EST 2011
On Wed, Nov 30, 2011 at 12:39 PM, Fernando Perez <fperez.net at gmail.com> wrote:
> On Wed, Nov 30, 2011 at 11:20 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>> On 30 November 2011 18:50, Thomas Kluyver <takowl at gmail.com> wrote:
>>> As a compromise, why don't we allow autocall of "foo x", but not "foo.bar
>>> x" (unless autocall is set to 2)? This preserves the main uses of autocall
>>> (len, print in Python 3, etc.), without needing attribute access.
>> I've done this in my autocall-safe branch, if anyone wants to test it:
>> Turning autocall up to 2 will still inspect attributes, but that's not the
>> If we're happy with this behaviour, I'll update docs and so forth.
> While for expert users this may be a good compromise, I worry that for
> newbies it becomes too much to explain out of the box. The rule now
> becomes "ipython will automatically call functions, but only if there
> are aguments and they are not being called form a nested namespace but
> directly from the global one, so we don't trigger multiple attribute
> accesses". If you're explaining that to a first-time user, they're
> already running out the door :)
It already is confusing, though, to some degree:
In : %autocall 2
Automatic calling is: Full
In : str 1
In : 1 + str 1
File "<ipython-input-17-f44744626b28>", line 1
1 + str 1
SyntaxError: invalid syntax
to someone who is completely new to Python, this can be a surprise (it
will also be a surprise when "str 1" doesn't work in their scripts).
So personally, I don't think autocall is friendly to beginner users
even as it is now, for the simple reason that it changes the syntax of
> It seems to me that this could instead be a new mode for autocall, and
> perhaps we should simply change to labels rather than numerical
> categories for autocall:
> - off (old 0): not at all
> - safe (no number): your proposal
> - smart (old 1): as before
> - full (old 2): as before
> The question remains what the default should be. There seems to be a
> lot of push for going to 'off' as the default, and I think the
> arguments carry some merit. My view of ipython has always been that
> it should be 'better than the plain python shell but fully transparent
> in being better', meaning that it should take all valid pyhton input
> and treat it as so, and only add convenience but not introduce special
> rules to worry about. In a sense, autocall fails at that because you
> do need to worry and there are valid cases where its behavior is fully
> different from plain python.
> I personally will keep it at 1 because I find that very useful, but
> I'm not the 'target audience' for this discussion.
> So in summary, from the feedback (thanks everyone), I'm leaning towards:
> - defaulting autocall to 0.
> - accepting Thomas' idea, if we can rework the machinery (in a
> backwards compatible way, so we still understand the 0,1,2 labels as
> synonyms for 'off', 'smart', 'full') to accept 'safe' as a new mode.
> How does that sound?
> IPython-dev mailing list
> IPython-dev at scipy.org
More information about the IPython-dev