lihaoyi / macropy

Macros in Python: quasiquotes, case classes, LINQ and more!
3.28k stars 178 forks source link

macropy.console not working with IPython #72

Closed rebcabin closed 8 years ago

rebcabin commented 9 years ago

repro:

$ python
Python 2.7.10 (default, Sep 22 2015, 12:25:10) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import macropy.console
0=[]=====> MacroPy Enabled <=====[]=0
>>> from macropy.case_classes import macros, case
>>> @case
... class Point(x,y): pass
... 
>>> p = Point(1,2)
>>> print p
Point(1, 2)
>>> 
>>> quit()
bbeckman at 34363bc84acc in ~/Documents
$ ipython
Python 2.7.10 (default, Sep 22 2015, 12:25:10) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import macropy.console
0=[]=====> MacroPy Enabled <=====[]=0
In : from macropy.case_classes import macros, case
In : @case
...: class Point(x,y): pass
...: 
In : q = Point(x,y)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'x' is not defined
In : 
Matrixio commented 8 years ago

I meet the same issue.

lihaoyi commented 8 years ago

Uhh you're not running the same code in the first and second examples, it's no wonder that the second one doesn't work