fluentpython / example-code

Example code for the book Fluent Python, 1st Edition (O'Reilly, 2015)
http://bit.ly/fluentpy
MIT License
5.56k stars 2.18k forks source link

improve Vector.__format__ to support * format specifier #4

Closed ghost closed 3 years ago

ghost commented 7 years ago

Added support for * specifier in Vector.__format__ to show only small number of components by default, but all if * is specified. Creating this pull request was suggested in the soapbox at the end of Chapter 10.

This request is open for suggestions or improvements and critique!

ramalho commented 3 years ago

Thank you for sharing, @alekseyrybalkin. This repository is intended to hold the code as it appears in the book, with changes only to fix bugs that existed when Fluent Python, First Edition was written (2013-2015), using Python 3.3-3.4. I added some directories with code that needed updating since Python 3.5, but I did not change the original files to update them.