Skip to content

Keywords should shadow magic functions#4237

Merged
takluyver merged 2 commits into
ipython:masterfrom
takluyver:keywords-shadow
Oct 3, 2013
Merged

Keywords should shadow magic functions#4237
takluyver merged 2 commits into
ipython:masterfrom
takluyver:keywords-shadow

Conversation

@takluyver
Copy link
Copy Markdown
Member

This is a problem I discovered while working on #4151 with @fperez.

Before:

In [1]: def myif(line):
   ...:     print 'boo'
   ...:     

In [2]: ip = get_ipython()

In [3]: ip.register_magic_function(myif, magic_name='if')

In [4]: if foo
boo

After:

In [1]: def myif(line):
    print 'boo'
   ...:     

In [2]: ip = get_ipython()

In [3]: ip.register_magic_function(myif, magic_name='if')

In [4]: if foo
  File "<ipython-input-4-4533b1cb7f6e>", line 1
    if foo
          ^
SyntaxError: invalid syntax

@Carreau
Copy link
Copy Markdown
Member

Carreau commented Sep 28, 2013

looks good.

@takluyver
Copy link
Copy Markdown
Member Author

Landing

takluyver added a commit that referenced this pull request Oct 3, 2013
Keywords should shadow magic functions
@takluyver takluyver merged commit ee0f717 into ipython:master Oct 3, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Keywords should shadow magic functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants