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


Groups > comp.lang.python > #105934

Re: List of Functions

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: List of Functions
Date Tue, 29 Mar 2016 10:40:18 +1100
Lines 20
Message-ID <mailman.120.1459208421.28225.python-list@python.org> (permalink)
References <3c44f0f8-d701-463e-bf2c-f5871c51bddf@googlegroups.com> <87bn5z1mkd.fsf@bsb.me.uk> <lf5d1qf2g7v.fsf@ling.helsinki.fi> <87mvpjx9kh.fsf@elektro.pacujo.net> <ndb8ln$u0f$1@dont-email.me> <87twjqn2jn.fsf@elektro.pacujo.net> <mailman.116.1459201207.28225.python-list@python.org> <56f9b5c2$0$1606$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de d133Vp3s0IetqCYiQyLYpAA9jeODya0GHJvuRAs7FcWA==
Return-Path <rosuav@gmail.com>
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; 'anyway.': 0.04; 'cc:addr :python-list': 0.09; 'yeah,': 0.09; ':-)': 0.12; '2016': 0.16; 'bases,': 0.16; 'dictionary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; "{'foo':": 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'example.': 0.18; 'instance,': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'class,': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; "d'aprano": 0.33; 'steven': 0.33; 'subject:List': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'self': 0.38; 'means': 0.39; 'called': 0.40; 'mar': 0.65; 'chrisa': 0.84; 'to:none': 0.91; 'improvement': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=5kuQwsCWQLJ0ZPL6YHROcdQRtRWdkMi3Bll5/9WCYJA=; b=Ekdh5IXhXSo3B5Y8wyk1drW36c4rXkoNXpCGo9VolmXJ15yXZvjTqau42cxUqhdXYc lORtrzemEEIlwmt7MX5/FOajrEFIzwEH8VWbXmjJ+YEpNOqjr7l0UomIBkFIaIsEuH4w lmE3/Eyk/sNX4BhB30MucerK8r2kplzAKj9/GXY6Qq8Q2zv9JmNWNTKFuIIuXkF1JiwZ GK49txqOBtYfgjJxTxc9WJyqog6RlG9V0YClJjZEfXGGpbcJ2iYKU2rwFvidtUyCPfS/ 78QC2gZd0QF655lJRL/Ebl2qvVP0y9HZjRz+pgx6szCIGrKdroOVft3CcefF6RqwGBzc x46A==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=5kuQwsCWQLJ0ZPL6YHROcdQRtRWdkMi3Bll5/9WCYJA=; b=KuGu4GEbny9fvN09zpT9g61aoorf9a3OO0GfHpp4L/mAeIGXsQgv+DTZJrYBTeA9Gd oeDo4NDk2ZuFgAenGg2dawNYaaAXmrNbZpU+vbs78c7ZgnifzYnB17Eupw2Z7hM0V1w9 pJcU2LXqwRf4V7viOWfXTQPCVJ1EeeSLbdN6R5c+M9Knoa5la6AQ+S9+tKcAcS0Ly7j/ ow1nrLKC3yIUKlB8fpefkYGKkUwNzq/iswk50etx1+/nkrXufDwrgtugDib200WWgGIf 4IgT/4vNgOwM9eSmUeb20abj1aTnru/qq+vKiqjiDjFo6lU8t0v4MudbsVJKB0qnf1DM 4RLA==
X-Gm-Message-State AD7BkJIvlUzafxW5kdgf520tQqBQjtxQdcq7vzNd+AMS4P3Qf7BtL5nNWpOgf9Ycie8u+hmTuibGNNb7iP9bQQ==
X-Received by 10.50.138.233 with SMTP id qt9mr12680630igb.13.1459208418905; Mon, 28 Mar 2016 16:40:18 -0700 (PDT)
In-Reply-To <56f9b5c2$0$1606$c3e8da3$5496439d@news.astraweb.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:105934

Show key headers only | View raw


On Tue, Mar 29, 2016 at 9:52 AM, Steven D'Aprano <steve@pearwood.info> wrote:
> That would be called "type" :-)
>
> type(name, bases, namespace) returns a new class:
>
>
> py> C = type("MyClass", (object,), {'foo': 1})
> py> C
> <class '__main__.MyClass'>
> py> C.foo
> 1

Yeah, but to do that in a single expression, you need to have all the
functions in the dictionary, so it's no improvement over
SimpleNamespace. The functions get attached to the class, not the
instance, which means they need 'self' - but without assignment, you
wouldn't be able to make much use of self anyway. Hence the call for
an example.

ChrisA

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


Thread

List of Functions Richard Riehle <rriehle@itu.edu> - 2016-03-27 12:38 -0700
  Re: List of Functions Erik <python@lucidity.plus.com> - 2016-03-28 00:10 +0100
  Re: List of Functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-28 01:19 +0100
    Re: List of Functions Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-28 10:51 +0300
      Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-28 11:58 +0300
        Re: List of Functions Dan Sommers <dan@tombstonezero.net> - 2016-03-28 12:39 +0000
          Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-28 16:40 +0300
            Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 08:40 +1100
              Re: List of Functions Steven D'Aprano <steve@pearwood.info> - 2016-03-29 09:52 +1100
                Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 10:40 +1100
                Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 07:49 +0300
              Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 07:45 +0300
                Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 16:00 +1100
      Re: List of Functions Steven D'Aprano <steve@pearwood.info> - 2016-03-29 10:40 +1100
        Re: List of Functions Random832 <random832@fastmail.com> - 2016-03-28 19:50 -0400
        Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 10:54 +1100
        Re: List of Functions Rustom Mody <rustompmody@gmail.com> - 2016-03-28 19:23 -0700
        Re: List of Functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-29 03:45 +0100
          Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 14:33 +1100
          Re: List of Functions Rustom Mody <rustompmody@gmail.com> - 2016-03-28 23:21 -0700
            Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 09:50 +0300
            Re: List of Functions Christian Gollwitzer <auriocus@gmx.de> - 2016-03-29 08:52 +0200

csiph-web