[Python-Dev] syntactic sugar idea for {static,class}methods

M.-A. Lemburg mal@lemburg.com
Tue, 12 Feb 2002 18:55:23 +0100


This is a multi-part message in MIME format.
--------------E8FBACF218F16A772D2300AE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

 
--------------E8FBACF218F16A772D2300AE
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Received: from lemburg.com (www.egenix.com [217.115.138.139])
	by www.egenix.com (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id g1CHegs25065;
	Tue, 12 Feb 2002 18:40:42 +0100
Message-ID: <3C6953B8.91157457@lemburg.com>
Date: Tue, 12 Feb 2002 18:41:12 +0100
From: "M.-A. Lemburg" <mal@lemburg.com>
Organization: eGenix.com Software GmbH
X-Mailer: Mozilla 4.78 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Michael Hudson <mwh@python.net>
Subject: Re: [Python-Dev] syntactic sugar idea for {static,class}methods
References: <2m6652my0x.fsf@starship.python.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael Hudson wrote:
> 
> Some time ago, Gareth McCaughan suggested a syntax for staticmethods.
> You'd write
> 
> class C(object):
>     def static(arg) [staticmethod]:
>         return 1 + arg
> 
> C.static(2)
>    => 3
> 

Certainly looks nice.

I'd just use a shorter name for [staticmethod], e.g. [static].

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/

--------------E8FBACF218F16A772D2300AE--