Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'syntax': 0.03; 'except:': 0.07; 'function,': 0.07; 'try:': 0.07; 'type,': 0.07; 'users,': 0.07; 'confuse': 0.09; 'useless': 0.09; 'cc:addr :python-list': 0.10; 'def': 0.10; '(like': 0.15; 'eckhardt': 0.16; 'filename:fname piece:signature': 0.16; 'foo(object):': 0.16; 'marker': 0.16; 'parentheses': 0.16; 'subject:import': 0.16; 'think?': 0.16; 'tuples,': 0.16; 'wrote:': 0.17; '(on': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'statement': 0.23; 'raise': 0.24; 'cc:no real name:2**0': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'argue': 0.29; 'idea,': 0.29; 'occurred': 0.29; 'overhead': 0.29; 'probably': 0.29; 'class': 0.29; 'unlike': 0.30; 'function': 0.30; 'code': 0.31; '(and': 0.32; 'etc.)': 0.32; 'german': 0.32; 'could': 0.32; 'print': 0.32; 'shorter': 0.33; 'received:192.168.2': 0.34; 'similar': 0.35; 'there': 0.35; 'characters': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'side': 0.61; 'back': 0.62; 'strange': 0.62; 'ever': 0.63; 'making': 0.64; 'harder': 0.65; 'fact,': 0.69; 'beats': 0.84; 'complexity': 0.84; 'construct': 0.84 Date: Wed, 25 Jul 2012 12:30:01 +0200 From: Philipp Hagemeister User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120624 Icedove/10.0.5 MIME-Version: 1.0 To: Ulrich Eckhardt Subject: Re: from future import pass_function References: In-Reply-To: X-Enigmail-Version: 1.4 OpenPGP: id=FAFB085C Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig6983CCBE770F084AB02ECEF3" Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 76 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343212216 news.xs4all.nl 6849 [2001:888:2000:d::a6]:41161 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26031 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6983CCBE770F084AB02ECEF3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Unlike the print statement, pass has no overboarding complexity (like >>, printing tuples, etc.) - it just serves as a marker (and practicality beats purity). And you don't ever want to use pass as a value (say, for map() or the right side of an assignment). In fact, if pass were a function, users could construct strange code like x =3D pass() def pass(): raise Exception('Are you slacking off? Get back to work!') And don't forget that while the parentheses mainly confuse users, they're also making it harder to type, and feel like useless overhead (similar to the parentheses in if (x): ). In fact, I'd argue that if pass were a function, None would be the better placeholder: try: do_something() except: None # 2 hard-to-type (on a German keyboard) characters shorter # (and probably way faster: No function call overhead and no need # to actually find out what pass happens to be in this context) - Philipp On 07/25/2012 10:40 AM, Ulrich Eckhardt wrote: > Hi! > > I just had an idea, it occurred to me that the pass statement is pretty= > similar to the print statement, and similarly to the print() function, > there could be a pass() function that does and returns nothing. > > Example: > def pass(): > return > > try: > do_something() > except: > pass() > > > One thing I don't like about this is the syntax > > class foo(object): > pass() > > > What do you think? > > Uli --------------enig6983CCBE770F084AB02ECEF3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEAREKAAYFAlAPyqsACgkQ9eq1gvr7CFwG0QCfdbVu/D7WxmsB8VwFVcrscpdq cIwAn3WreGWR34zsYaBd6sFmUANg/PUQ =LwyH -----END PGP SIGNATURE----- --------------enig6983CCBE770F084AB02ECEF3--