Article View: pl.comp.lang.python
Article #21424Re: przypisac nieskonczonosc
From: Sulsa
Date: Thu, 18 Oct 2007 08:36
Date: Thu, 18 Oct 2007 08:36
23 lines
1598 bytes
1598 bytes
On Tue, 16 Oct 2007 16:07:03 -0000 Marcin Ciura <mciura@gmail.com> wrote: > On Oct 16, 10:34 am, Sulsa <su...@dontmail.me> wrote: > > Jak liczbie zmiennoprzecinkowej w pythonie przypisac wartość > > +nieskonczoność > > Jesli potrzebujesz tej nieskonczonosci tylko do porownan > i nie bedziesz na niej wykonywac operacji arytmetycznych, to: > > class Infinity(int): > def __cmp__(self, other): > if isinstance(other, self.__class__): return self - other > return self > > MinusInf = Infinity(-9999) > PlusInf = Infinity(+9999) > > Rozszerzenie klasy o metody __str__() i __repr__() > to cwiczenie dla czytelnika, ktoremu sa one potrzebne. > Marcin Musialem ja niestety przekazac do metody w c wiec taka klasa odpada.
Technical Details
Message-ID:
<20071018103634.2b851826.sulsa@dontmail.me>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailReferences:
<20071016103416.e69a7bc7.sulsa@dontmail.me> <1192550823.753950.10200@v29g2000prd.googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: Sulsa <sulsa@dontmail.me> Newsgroups: pl.comp.lang.python Subject: Re: przypisac nieskonczonosc Date: Thu, 18 Oct 2007 10:36:34 +0200 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 23 Message-ID: <20071018103634.2b851826.sulsa@dontmail.me> References: <20071016103416.e69a7bc7.sulsa@dontmail.me> <1192550823.753950.10200@v29g2000prd.googlegroups.com> NNTP-Posting-Host: pc-212-191-87-58.p.lodz.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1192696771 1543 212.191.87.58 (18 Oct 2007 08:39:31 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Thu, 18 Oct 2007 08:39:31 +0000 (UTC) X-Newsreader: Sylpheed 2.4.5 (GTK+ 2.10.14; i686-pc-linux-gnu) X-User: sulsa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit