🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #64

Re: Zakresy w Pythonie i Ruby

#64
From: Jaroslaw Zabiello
Date: Wed, 26 Jul 2006 09:58
16 lines
1109 bytes
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. 

-- 
Jarosław Zabiełło
http://blog.zabiello.com
Technical Details
Message-ID: <oimvnk2uggad.fkm26kcokml3.dlg@40tude.net>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <hnmwlvh87ny7$.1sx8hitfg70hj.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: Jaroslaw Zabiello <hipertracker@gmail.com>
Newsgroups: pl.comp.lang.ruby
Subject: Re: Zakresy w Pythonie i Ruby
Date: Wed, 26 Jul 2006 10:58:20 +0100
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 16
Message-ID: <oimvnk2uggad.fkm26kcokml3.dlg@40tude.net>
References: <hnmwlvh87ny7$.1sx8hitfg70hj.dlg@40tude.net>
NNTP-Posting-Host: 213.190.141.10
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1153907907 13852 213.190.141.10 (26 Jul 2006 09:58:27 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Wed, 26 Jul 2006 09:58:27 +0000 (UTC)
X-User: newsgate2
User-Agent: 40tude_Dialog/2.0.15.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit