A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-July/037366.html below:

[Python-Dev] A syntax for function attributes?

[Python-Dev] A syntax for function attributes? [Python-Dev] A syntax for function attributes?Charles Cazabon python@discworld.dyndns.org
Thu, 31 Jul 2003 09:10:49 -0600
Pat Miller <patmiller@llnl.gov> wrote:
> Michael wrote:
> > I don't object to a syntax for function attributes [...]
 
> I agree that
> 
> def sqr(x):
>     return x*x
> sqr.inline = true
> 
> is about the same length as
> 
> def sqr [inline=true](x):
>     return x*x

If it's going to look like a mapping, and quack like a mapping, why not make it
a mapping?

  def funcname(args) {attribute_mapping} :
      ...

Docstrings then just become symantic sugar for this:

  def sqr(x) {
    '__doc__' : '''Return the square of x.''',
    'inline' : True
  }:
      return x*x

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon                           <python@discworld.dyndns.org>
GPL'ed software available at:     http://www.qcc.ca/~charlesc/software/
-----------------------------------------------------------------------



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4