#69 Declined
Repository
kostialopuhin/pypy-my-messed-up-fork pypy-my-messed-up-fork
Branch
default
Repository
pypy/pypy pypy
Branch
default

Fix Issue 1180 - implement bool formatting

Author
  1. Konstantin Lopuhin avatarKonstantin Lopuhin
Reviewers
Description

Not sure if I should have added tests in lib-python

Comments (3)

  1. Amaury Forgeot d'Arc

    Could you add some tests with a format_spec? For example, assert "{:f}".format(True) == '1.000000' assert "{:05d}".format(False) == '00000' (these are values returned by CPython. To check, run tests with the -A option -- and be sure to use Python2.7)

    Actually, in CPython there is no specific code for booleans. But an empty format_spec always delegate to str().

  2. Armin Rigo

    Ah, so "{0}".format(x) returns "foo" if x is an instance of class foo(int): def str(self): return "foo". It even works already on pypy... Not sure I understand why it does, but bools don't print as their str()?

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.