Article View: pl.comp.lang.ruby
Article #65Re: Zakresy w Pythonie i Ruby
From: Daniel Owsiański
Date: Wed, 26 Jul 2006 11:36
Date: Wed, 26 Jul 2006 11:36
23 lines
1564 bytes
1564 bytes
Jaroslaw Zabiello napisał(a): > Zapomnialem o pythonowym __contains__. Po dodaniu do klasy Range: > > def __contains__(self,value): > return self.included(value) > > mozna wtedy wykonywac > > >>> 3.14 in Range(1,10) > True > >>>>31.14 in Range(1,10) > Nie wiem czy w Ruby mozna przeciazyc slowo "in". Chyba nie. czy nie sądzisz, że bardziej czytelna (i przy okazji bardziej zgodna z ruby-way) byłaby konstrukcja: 31.15.in? 1..5 czyli dodanie metody 'in?' do Numeric -- daniel http://jarmark.org
Technical Details
Message-ID:
<ea7k48$98m$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailReferences:
<hnmwlvh87ny7$.1sx8hitfg70hj.dlg@40tude.net> <oimvnk2uggad.fkm26kcokml3.dlg@40tude.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: Daniel Owsiański <daniel@jarmark.org> Newsgroups: pl.comp.lang.ruby Subject: Re: Zakresy w Pythonie i Ruby Date: Wed, 26 Jul 2006 13:36:41 +0200 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 23 Message-ID: <ea7k48$98m$1@inews.gazeta.pl> References: <hnmwlvh87ny7$.1sx8hitfg70hj.dlg@40tude.net> <oimvnk2uggad.fkm26kcokml3.dlg@40tude.net> NNTP-Posting-Host: chello087206189165.chello.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1153913800 9494 87.206.189.165 (26 Jul 2006 11:36:40 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Wed, 26 Jul 2006 11:36:40 +0000 (UTC) In-Reply-To: <oimvnk2uggad.fkm26kcokml3.dlg@40tude.net> X-Antivirus-Status: Clean X-Accept-Language: pl, en-us, en X-User: l00p X-Antivirus: avast! (VPS 0630-2, 2006-07-26), Outbound message User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit