Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105075

Re: Case Statements

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Newsgroups comp.lang.python
Subject Re: Case Statements
Date Thu, 17 Mar 2016 09:36:47 +0100
Lines 42
Message-ID <mailman.262.1458203805.12893.python-list@python.org> (permalink)
References <f30500db-19cb-4de8-81f1-6eb77c28b3b4@googlegroups.com> <30502a2e-0bad-4b0f-a1e8-a2b40b0d7ab9@googlegroups.com> <mailman.181.1458102409.12893.python-list@python.org> <ncb4e0$op1$1@dont-email.me> <ncb6jk$rrm$1@ger.gmane.org> <56E928D4.3000701@rece.vub.ac.be> <ncbac2$qtk$1@ger.gmane.org> <56E93ADD.9040500@rece.vub.ac.be> <ncbeq6$vq$1@ger.gmane.org> <56E961C9.7040008@rece.vub.ac.be> <ncbp2b$ge6$3@ger.gmane.org> <56E97B60.3060402@rece.vub.ac.be> <ncc4tb$6kj$1@ger.gmane.org> <56E9A66E.4030905@rece.vub.ac.be> <mailman.253.1458170061.12893.python-list@python.org> <56e9f7f9$0$1597$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmpZD6ZKFx7VEAZUJreZp8MuNkuv19Py255X-hPBLA2tPA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de y8CWoSJ2oRLV5/SfaC2EYgy0TPBDh8G8qGLgbryMWNLQ==
Return-Path <antoon.pardon@rece.vub.ac.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:134': 0.05; 'feature.': 0.07; 'line:': 0.07; 'so?': 0.07; 'messing': 0.09; 'python': 0.10; 'syntax': 0.13; 'thu,': 0.15; '11:19': 0.16; '2016': 0.16; 'general.': 0.16; 'really?': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rewriting': 0.16; 'sugar': 0.16; 'syntactic': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'implementing': 0.18; '>>>': 0.20; 'work,': 0.21; 'decorator': 0.22; 'features,': 0.22; 'names.': 0.22; 'referring': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'example': 0.26; 'chris': 0.26; 'received:be': 0.30; "can't": 0.32; 'run': 0.33; 'class': 0.33; 'accessible': 0.33; "d'aprano": 0.33; 'decorators': 0.33; 'foo': 0.33; 'steven': 0.33; 'previous': 0.34; 'add': 0.34; 'gets': 0.35; 'but': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; "won't": 0.38; 'means': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'avoid': 0.61; 'provide': 0.61; 'back': 0.62; 'for:': 0.64; 'other.': 0.64; 'mar': 0.65; 'detail.': 0.66; 'angelico:': 0.84; 'decorator.': 0.84; 'decorators.': 0.84; 'decorators:': 0.84; 'pardon': 0.84; 'schreef': 0.84
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AugKAMpr6laGuA9G/2dsb2JhbABehGEBJbwFhg0CggABAQEBAQFlhGkBAQQjVRELGAICBRYLAgIJAwIBAgFFEAMGAgKII7Bwi0yDeQEBCAIefIUihESFCII0gToFjTqKGIFQjDGJI4VijwJig2ZpAYpiAQEB
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0
In-Reply-To <CAPTjJmpZD6ZKFx7VEAZUJreZp8MuNkuv19Py255X-hPBLA2tPA@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:105075

Show key headers only | View raw


Op 17-03-16 om 01:31 schreef Chris Angelico:
> On Thu, Mar 17, 2016 at 11:19 AM, Steven D'Aprano <steve@pearwood.info> wrote:
>> On Thu, 17 Mar 2016 10:14 am, Chris Angelico wrote:
>>
>>> On Thu, Mar 17, 2016 at 5:31 AM, Antoon Pardon
>>> <antoon.pardon@rece.vub.ac.be> wrote:
>>>> It can be yes. Look at decorators. They don't provide functionality
>>>> we wouldn't have without them.
>>> Really? Okay, try implementing this without decorators:
>> [...]
>>> @monkeypatch
>>> class Foo:
>> [...]
>>
>>
>> I think Antoon is referring to decorator *syntax*, not the concept of
>> decorators in general. Decorator syntax is just syntactic sugar for:
>>
>>
>> class Foo:
>>     ...
>>
>> Foo = monkeypatch(Foo)
>>
>> which has been valid all the way back to Python 1.0.
>>
> Yes... in theory. But try rewriting my example to avoid decorator
> syntax. It won't work, because of this line:
>
>     orig = globals()[cls.__name__]
>
> It depends on the decorator being run before the name actually gets
> bound - which means the previous class is available to the decorator.
> You can't do that without decorator syntax, or messing around with
> multiple names.

So? That is an implementation detail. With a new features, functionality
can now be accessible in a way it was not before the feature. It still doesn't
add new functionality, which in this case was just transferring methods from
one class to an other.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Case Statements jj0gen0info@gmail.com - 2016-03-15 13:46 -0700
  Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 23:11 +0000
  Re: Case Statements jj0gen0info@gmail.com - 2016-03-15 16:47 -0700
    Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 23:58 +0000
    Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 00:51 +0000
      Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 01:05 +0000
  Re: Case Statements jj0gen0info@gmail.com - 2016-03-15 18:55 -0700
    Re: Case Statements "Mario R. Osorio" <nimbiotics@gmail.com> - 2016-03-15 21:06 -0700
      Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 10:34 +0000
        Re: Case Statements Steven D'Aprano <steve@pearwood.info> - 2016-03-16 23:56 +1100
    Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 04:26 +0000
      Re: Case Statements Christian Gollwitzer <auriocus@gmx.de> - 2016-03-16 09:13 +0100
        Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 08:47 +0000
        Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-16 11:16 +0200
        Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-16 10:35 +0100
        Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 09:51 +0000
          Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 19:41 +0000
            Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 22:30 +0000
        Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-16 11:52 +0100
        Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 11:07 +0000
          Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 11:16 +0000
            Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 11:33 +0000
            Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-16 14:21 +0200
              Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 12:53 +0000
                Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-16 16:31 +0200
                Re: Case Statements BartC <bc@freeuk.com> - 2016-03-16 15:00 +0000
                Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-16 19:07 +0200
              Re: Case Statements Rustom Mody <rustompmody@gmail.com> - 2016-03-20 01:01 -0700
                Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-20 08:29 +0000
        Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-16 14:38 +0100
        Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 14:02 +0000
        Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-16 21:27 +0200
          Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-17 09:22 +0100
            Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-17 10:57 +0200
              Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-17 10:12 +0100
        Re: Case Statements Steven D'Aprano <steve@pearwood.info> - 2016-03-17 11:19 +1100
          Re: Case Statements Steven D'Aprano <steve@pearwood.info> - 2016-03-17 12:54 +1100
            Re: Case Statements Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-17 18:45 +1300
              Re: Case Statements Chris Angelico <rosuav@gmail.com> - 2016-03-17 17:30 +1100
                Re: Case Statements Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-18 18:59 +1300
              Re: Case Statements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-03-17 17:29 +1100
                Re: Case Statements Chris Angelico <rosuav@gmail.com> - 2016-03-17 17:48 +1100
                Re: Case Statements Steven D'Aprano <steve@pearwood.info> - 2016-03-17 21:53 +1100
                Re: Case Statements Chris Angelico <rosuav@gmail.com> - 2016-03-17 22:49 +1100
            Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-17 10:23 +0100
            Re: Case Statements Chris Angelico <rosuav@gmail.com> - 2016-03-17 20:55 +1100
          Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-17 09:36 +0100
        Re: Case Statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-03-17 09:38 +0100
  Re: Case Statements l0r0m0a0i0l@gmail.com - 2016-03-16 06:15 -0700
    Re: Case Statements Steven D'Aprano <steve@pearwood.info> - 2016-03-17 00:27 +1100
      Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 14:00 +0000
    Re: Case Statements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-16 13:59 +0000
  Re: Case Statements l0r0m0a0i0l@gmail.com - 2016-03-16 07:21 -0700
    Re: Case Statements Marko Rauhamaa <marko@pacujo.net> - 2016-03-16 16:33 +0200

csiph-web