A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20090902/f95e8e03/attachment.htm below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18783">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Hi All,</FONT></DIV>
<DIV><FONT size=2 face=Arial>This is my first post to python-dev so I will 
briefly introduce myself:&nbsp; My name is Rob Cliffe and I am a commercial 
programmer living in London, UK.&nbsp; I have some 30 years of programming 
experience but have only been using Python for a couple of years.</FONT></DIV>
<DIV><FONT size=2 face=Arial>First I want to say what a fantastic language 
Python is.&nbsp; It is THE best language for development in my opinion, and a 
joy to use.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>My specific issue:</FONT></DIV>
<DIV><FONT size=2 face=Arial>I eventually got my head round decorator syntax and 
realised that what came after the <A href="mailto:'@'">'@'</A> was (basically) a 
function that took a function as argument and returned a function as 
result.</FONT></DIV>
<DIV><FONT size=2 face=Arial>However it seems to me&nbsp;unPythonesque (i.e. an 
exception to Python's normal consistency) that the syntax of what follows the <A 
href="mailto:'@'">'@'</A> should be restricted to either a single (function) 
identifier or a single (function) identifier with an argument list.</FONT></DIV>
<DIV><FONT size=2 face=Arial>The example I tried, which seems not an 
unreasonable sort of thing to do, was along the lines of:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>def deco1(func):</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; &lt;deco1-suite&gt;</FONT></DIV>
<DIV><FONT size=2 face=Arial>def deco2(func):</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; &lt;deco2-suite&gt;</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>DecoList = [deco1, deco2]</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>@DecoList[0]&nbsp;&nbsp;&nbsp; # NO - CAUSES SYNTAX 
ERROR</FONT></DIV>
<DIV><FONT size=2 face=Arial>def foo():</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; pass</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>I am sure other guys have their own 
examples.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>I am of course not the first person to raise this 
issue, and I see that Guido has a "gut feeling" against allowing a general 
expression after the <A href="mailto:'@'">'@'</A>.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>BUT - a general expression can be "smuggled in" 
very easily as a function argument:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>def Identity(x): return x</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>@Identity(DecoList[0])&nbsp;&nbsp;&nbsp; # THIS 
WORKS</FONT></DIV>
<DIV><FONT size=2 face=Arial>def foo():</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; pass</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>So - the syntax restriction seems not 
only&nbsp;inconsistent, but&nbsp;pointless; it doesn't forbid anything, but 
merely means we have to do it in a slightly convoluted (unPythonesque) 
way.&nbsp; So please, Guido, will you reconsider?</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>Best wishes</FONT></DIV>
<DIV><FONT size=2 face=Arial>Rob Cliffe</FONT></DIV></BODY></HTML>

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