Re: [pypy-dev] Here's a fun one...

2011-09-01 Thread Dino Viehland

Antonio wrote:
> it seems to work fine with pypy 1.6.  Note that str() is called twice for each
> line, so we get 1, 3, 5, 7..., but this happens only on cpython.

Ahh yeah, I think I had some weird 1.5 build on my laptop where I tried it. 
Guess it's time to upgrade.
___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


[pypy-dev] Here's a fun one...

2011-08-31 Thread Dino Viehland
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