A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-January/076623.html below:

[Python-Dev] functions vs methods (was Re: trunc())

[Python-Dev] functions vs methods (was Re: trunc()) [Python-Dev] functions vs methods (was Re: trunc())Raymond Hettinger python at rcn.com
Tue Jan 29 04:19:38 CET 2008
> No, using trunc(x) makes it clear that the argument and return
> value are numbers. Using x.trunc() doesn't.

Not sure where this is notion comes from. 
Terry Reedy's post provides a datapoint to the contrary.
Besides, there is no problem along these lines that
can't be cured by a better method name:

    f.integer_portion()

Also, if you go the method route, then the API can easily
be expanded to cover all the normal rounding methods:

   f.round_to_even()
   f.round_half_up()
       ...

These are all specific and explicit.

Also, we can take advantage of the ABC mixin capabilities
to automatically provide all of these given one or two of
them as primitives.


Raymond


P.S I get no shortage of hits for searches like:
  http://www.google.com/search?q=truncate+string
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4