🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #8657

Re: Największy problem Pythona.

#8657
From: Piotr Dembiński
Date: Tue, 10 May 2005 19:56
33 lines
1736 bytes
Dnia Tue, 10 May 2005 15:29:20 +0200, Przemek Wiśniewski <sdf@fasd.sdf> napisał:

[...]

> To akurat nie problem, kompilator Ocamla potrafi zgadywac typ funkcjina podstawie argumentow, dobre ide tez by moglo - jedyne wymaganieto takie, zeby kiedys ten typ jakos okreslic.

#v+
 from posix import environ

class FallbackClass:
     pass

class MyClass:
     pass

if '__main__' == __name__:
     try:
         cname = environ['PYCLASS']
     except KeyError:
         cname = 'FallbackClass'

     o = eval('%s()' % cname)
     print o, type(o), id(o)
#v-

> Chodzi o to, ze klasa moze
> sie zmieniac w czasie dzialania programu.

Plus każdy obiekt może mieć swoje własne, również dodawane
w trakcie działania programu, metody i pola.

-- 
http://www.piotr.dembiński.prv.pl
Technical Details
Message-ID: <op.sqksb2tmm6ja2j@hector.domek>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <jsq2enrcpp4r$.nmpn8bgh83ge.dlg@40tude.net> <1rbhne1rr1a3x$.h8m7p6ogf075.dlg@40tude.net> <zxj1u4nw6xe5$.5k7xj103dinh$.dlg@40tude.net> <d5qcvh$ne1$1@gw.magellan.net.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: Piotr Dembiński <pdemb@gazeta.pl>
Newsgroups: pl.comp.lang.python
Subject: Re: Największy problem Pythona.
Date: Tue, 10 May 2005 21:56:16 +0200
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 33
Message-ID: <op.sqksb2tmm6ja2j@hector.domek>
References: <jsq2enrcpp4r$.nmpn8bgh83ge.dlg@40tude.net> <1rbhne1rr1a3x$.h8m7p6ogf075.dlg@40tude.net> <zxj1u4nw6xe5$.5k7xj103dinh$.dlg@40tude.net> <d5qcvh$ne1$1@gw.magellan.net.pl>
NNTP-Posting-Host: pb71.konin.sdi.tpnet.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1115755205 13896 217.96.175.71 (10 May 2005 20:00:05 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Tue, 10 May 2005 20:00:05 +0000 (UTC)
X-User: pdemb
User-Agent: Opera M2/8.0 (Linux, build 1095)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit