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


Groups > comp.lang.python > #55932

Re: Behaviour-based interface/protocol implementation?

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mailing@franzoni.eu>
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; '(python': 0.05; 'args': 0.07; 'method,': 0.07; 'subject:based': 0.07; 'python': 0.08; 'argument,': 0.09; 'arguments,': 0.09; 'arguments.': 0.09; 'counting': 0.09; 'positional': 0.09; 'pm,': 0.12; 'wrote:': 0.14; 'def': 0.14; 'argument': 0.15; 'docstring': 0.16; 'furman': 0.16; 'only,': 0.16; 'subject:interface': 0.16; 'subject:skip:i 10': 0.16; 'cc:no real name:2**0': 0.17; 'cc:2**0': 0.21; 'assume': 0.22; 'jan': 0.22; '27,': 0.23; 'alan': 0.23; 'header:In-Reply- To:1': 0.23; 'cc:addr:python-list': 0.24; 'message- id:@mail.gmail.com': 0.29; 'subject:?': 0.29; 'cc:addr:python.org': 0.30; '...': 0.31; 'actually': 0.31; 'thu,': 0.31; 'parse': 0.34; 'whether': 0.34; 'checking': 0.35; 'subject:/': 0.37; 'names': 0.38; 'either': 0.38; 'received:google.com': 0.38; 'might': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'could': 0.40; 'contact': 0.65
MIME-Version 1.0
In-Reply-To <4D41CE70.1090900@stoneleaf.us>
References <AANLkTi=BFiPKC+4JHiupHHr2kLwEBoSH9P0t60E_kCQV@mail.gmail.com> <4D41CE70.1090900@stoneleaf.us>
From Alan Franzoni <mailing@franzoni.eu>
Date Thu, 27 Jan 2011 22:12:45 +0100
Subject Re: Behaviour-based interface/protocol implementation?
To Ethan Furman <ethan@stoneleaf.us>
Content-Type text/plain; charset=UTF-8
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1395.1296162794.6505.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 82.94.164.166
X-Trace 1296162794 news.xs4all.nl 65870 [::ffff:82.94.164.166]:36699
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55932

Show key headers only | View raw


On Thu, Jan 27, 2011 at 8:58 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
> When you signature check, do you mean counting the number of arguments, or
> actually checking argument types?

In order to check for argument types I should either assume type
annotation (python 3 only, optional) or parse the docstring for the
method, which might not be available or be out of sync.

I just want to check for method name, number and/or names of the
arguments. It might not be trivial in python because the very same
argument can be passed either as a positional or a kw argument, so

def method1(self, a, b):
    ...

def method1(self, c, d):
     ...

could satisfy or not the very same interface, depending whether the
args are passed as postional or kw.


-- 
Alan Franzoni
--
contact me at public@[mysurname].eu

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


Thread

Re: Behaviour-based interface/protocol implementation? Alan Franzoni <mailing@franzoni.eu> - 2011-01-27 22:12 +0100

csiph-web