This came up on an internal discussion, I thought it was fun, especially given 
that we all behave differently:

Paste this into the REPL:

class PS1(object):
  def __init__(self): self.count = 0
  def __str__(self):
    self.count += 1
    return "%d >>>" % self.count

import sys
sys.ps1 = PS1()


CPython  - calls __str__
Jython - calls __repr__
IronPython - ignores ps1
PyPy - unsupported operand type for unary buffer: 'PS1'

(note I don't necessarily have the latest versions for everyone)

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to