🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Konstruktor funkcji

#27969
From: Wojciech Muła
Date: Sat, 26 Mar 2011 10:30
18 lines
1299 bytes
Roman Dobosz wrote:
> On Sat, 26 Mar 2011 10:32:54 +0100
> szatkus <szatkus@gmail.com> wrote:
>
>> Czy w pythonie da się tworzyć funkcje w locie tak jak w JavaScript?
>> Np. zmienna = function(arg) {cośtam, cośtam;}
>
> lambda? np:
>
> In [1]: foo = lambda arg1, arg2: arg1 * arg2
>
> In [2]: foo(5, 2)
> Out[2]: 7

Lambda pozwala uzywac tylko wyrazen. Ale mozna definiowac
funkcje (i klasy) w dowolnym miejscu kodu.

w.
Technical Details
Message-ID: <slrniorg1g.ral.wojciech_mula@cat.tac>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!cat.tac!not-for-mail
References: <20110326103254.cdd3b35e.szatkus@gmail.com> <20110326105858.ebb84426.gryf_esm-no@spam-o2.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!cat.tac!not-for-mail
From: Wojciech Muła
 <wojciech_mula@poczta.null.onet.pl.invalid>
Newsgroups: pl.comp.lang.python
Subject: Re: Konstruktor funkcji
Date: Sat, 26 Mar 2011 11:30:08 +0100
Organization: http://0x80.pl/
Lines: 18
Message-ID: <slrniorg1g.ral.wojciech_mula@cat.tac>
References: <20110326103254.cdd3b35e.szatkus@gmail.com> <20110326105858.ebb84426.gryf_esm-no@spam-o2.pl>
NNTP-Posting-Host: public92187.xdsl.centertel.pl
Mime-Version: 1.0
X-Trace: news.onet.pl 1301135437 27126 188.47.232.27 (26 Mar 2011 10:30:37 GMT)
X-Complaints-To: niusy@onet.pl
NNTP-Posting-Date: Sat, 26 Mar 2011 10:30:37 +0000 (UTC)
User-Agent: slrn/pre1.0.0-18 (Linux)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit