A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-August/016994.html below:

[Python-Dev] ++x oddnes

[Python-Dev] ++x oddnes [Python-Dev] ++x oddnesFredrik Lundh fredrik@pythonware.com
Mon, 13 Aug 2001 18:55:22 +0200
moshe wrote:

> Everybody is ignoring the obvious correct way to do it:
> 
> class StupidCounter:
>     count = 0
>     def __pos__(self):
>         self.count = self.count+0.5
>         return self
>     def __repr__(self): return str(int(self.count))
>     def __int__(self): return int(self.count)

that was my first implementation (TooStupidCounter).  but
to avoid an endless float vs. integer thread, I decided to post
the plain StupidCounter version instead.

(SlightlyLessStupidCounter is same as StupidCounter,
but returns self.count instead of 0)

</F>




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