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


Groups > comp.lang.python > #103887

Re: What arguments are passed to the __new__ method ?

From Peter Pearson <pkpearson@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: What arguments are passed to the __new__ method ?
Date 2016-03-02 17:40 +0000
Message-ID <djoms1F1q2aU2@mid.individual.net> (permalink)
References <56d5d043$0$632$426a74cc@news.free.fr>

Show all headers | View raw


On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote:
>
> It's not clear to me what arguments are passed to the
> __new__ method. Here is a piece of code:
>
>
> class Premiere:
>
>     def __new__(cls, price):
>          return object.__new__(cls)
>
>     def __init__(self, price):
>             pass
[snip]

Of course, maybe you don't need to define a __new__ method at all.
Personally, I find that __init__ suffices for my simple needs.

-- 
To email me, substitute nowhere->runbox, invalid->com.

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


Thread

What arguments are passed to the __new__ method ? "ast" <nomail@invalid.com> - 2016-03-01 18:24 +0100
  Re: What arguments are passed to the __new__ method ? eryk sun <eryksun@gmail.com> - 2016-03-01 13:54 -0600
  Re: What arguments are passed to the __new__ method ? Terry Reedy <tjreedy@udel.edu> - 2016-03-01 15:27 -0500
  Re: What arguments are passed to the __new__ method ? eryk sun <eryksun@gmail.com> - 2016-03-01 15:09 -0600
  Re: What arguments are passed to the __new__ method ? "ast" <nomail@invalid.com> - 2016-03-02 10:23 +0100
    Re: What arguments are passed to the __new__ method ? Steven D'Aprano <steve@pearwood.info> - 2016-03-02 22:02 +1100
  Re: What arguments are passed to the __new__ method ? Peter Pearson <pkpearson@nowhere.invalid> - 2016-03-02 17:40 +0000
    Re: What arguments are passed to the __new__ method ? Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-03-02 17:57 +0000
      Re: What arguments are passed to the __new__ method ? Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-02 11:26 -0700

csiph-web