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/037349.html below:

[Python-Dev] A syntax for function attributes?

[Python-Dev] A syntax for function attributes? [Python-Dev] A syntax for function attributes?Pat Miller patmiller@llnl.gov
Wed, 30 Jul 2003 11:45:16 -0700
I can imagine lots of ways that these attributes can be useful
and would like to see this extension in some form.  If nothing
else, they can be used to help guide optimizations.

I can imagine:

def sqr [inline=true](x):
   return x*x

or

def debug [debug_only=true](*messages):
    global debugging
    if debugging:
      print "DEBUG",' '.join([str(x) for x in messages])
      return

In the first case, maybe a bytecode inliner could move the code into a caller
In the second case, if debugging were turned off, the function call
could be made into a NOP.

I think it essential to use some dense syntax.  It would be messy if it
were

def sqr(x):
    return x*x
sqr.inline = true



Pat

-- 
Patrick Miller | (925) 423-0309 | http://www.llnl.gov/CASC/people/pmiller

Fanaticism consists of redoubling your efforts when you have forgotten your
aim. -- George Santayana




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