Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Yann Kaiser Newsgroups: comp.lang.python Subject: Re: Same function but different names with different set of default arguments Date: Thu, 21 Jan 2016 07:49:54 +0000 Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de b3GQYhK/s/rQhnaNtzZObArNAcGtAVqSAuh+o9QBJO7w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '21,': 0.07; 'subject:set': 0.09; 'jan': 0.11; 'def': 0.13; 'received:74.125.82.44': 0.15; 'thu,': 0.15; 'code?': 0.16; 'paulo': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:default': 0.16; 'wrote:': 0.16; 'pfxlen:0': 0.18; 'to:2**1': 0.21; 'arguments': 0.22; 'header:In- Reply-To:1': 0.24; 'all.': 0.24; 'message-id:@mail.gmail.com': 0.27; 'fastest': 0.27; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'received:74.125.82': 0.35; 'url:org': 0.36; 'keyword': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'default': 0.61; 'treats': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=06Olz+HN13y7uahciATE/veYpf4YqjLg7NB79vOfi3Q=; b=X/BuEiptsFTtbMVfU7w5aA6ylnqecmSTNnv/zV5SbtND5bbRBddyZkGfAexU/nfly1 7w9jdJPsTIzzZhTTVNkGJWqOEXFggfcZufAMz1gmFnshG15RJlxm7+NEwSyILN4D6Noh QNZTflzCt65WvlvfMf1plrKC28AJMof0DfDOwrvE71yx+fxFFBwcLNeg8YYGYO0Z9xzN c9FqntbdL2PH9Gnc0+2AYL+SqfFQUBdxwpvBAX1sbuM9/fG8hWSh+yAsWOLf1g0sB/c4 uQX6exjq1wUHfZyzmKOuAeo9w8sjq3G0LKJKmd9Pl+LQfCr14hg9k+V5VOh0PcitavTn V54Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; bh=06Olz+HN13y7uahciATE/veYpf4YqjLg7NB79vOfi3Q=; b=HTAdkQ5he6DCb4q9FO8lyFCzEufHcvSSOdB1rbL4V2O/CgSACRUacPqlxYHkHDNg9F KejXtNm554Xvzr+vTMhrvNMYh84hPpJaBR04uEHUSOEKsPNFoZx0AG5QYXMIKcjKpUm8 mRufU5G5sX3wBJZEeuHtnoQfi1Z1FOOehCMWOnAObSIEqEAL0XygnYpV+9hzcSFjDVMF N0zh7kiYdkwtpr2YCuk8J1pyRo/CLZiS8TltolBLkoEtczq2JbeQeZbknwNpg35+wK9X oCiB6Pt4crziJLpOLMf07p6sQ2Lxs3Kcem8f8sO/OOArRzyxMkgRy0wfqtlXqXCEEIdA ybyw== X-Gm-Message-State: AG10YOQNASYeFdUglNQlbe5I4zZEWbpXh69xeKQ808HnBj+8R3TSPIP7a07IiUtqJ2x1FOtqFFAjVMjvNvAtKQ== X-Received: by 10.28.6.201 with SMTP id 192mr9129962wmg.0.1453362604584; Wed, 20 Jan 2016 23:50:04 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101945 partial treats keyword arguments as default values, though they become keyword-only as a result : f1 = functools.partial(g, p="p1") On Thu, Jan 21, 2016, 08:35 Paulo da Silva wrote: > Hi all. > > What is the fastest implementation of the following code? > > def g(p): > ... > return something > > def f1(p="p1"): > return g(p) > > def f2(p="p2"): > return g(p) > > Thanks > Paulo > -- > https://mail.python.org/mailman/listinfo/python-list >