##// END OF EJS Templates
Renamed __pretty__ to _repr_pretty_ and changed updated pretty.py...
Renamed __pretty__ to _repr_pretty_ and changed updated pretty.py * Throughout the codebase, __pretty__ has been changed to _repr_pretty_ to match general convention for special method names. * The logic in pretty.py now matches that in formatters.py in that formatters that are callables are tried first and then special methods are used.

File last commit:

r3879:4241df5e
r3879:4241df5e
Show More
display.py
24 lines | 540 B | text/x-python | PythonLexer
"""Code that shows off the IPython display logic.
"""
from IPython.core.display import (
display, display_pretty, display_html,
display_svg, display_json
)
class Circle(object):
def __init__(self, radius):
self.radius = radius
def _repr_pretty_(self, p, cycle):
p.text(u"\u25CB")
def _repr_html_(self):
return "<h1>Cirle: radius=%s</h1>" % self.radius
def _repr_svg_(self):
return """<svg>
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/>
</svg>"""