Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'example:': 0.03; 'cc:addr :python-list': 0.11; 'suggest': 0.14; 'acted': 0.16; 'hashes': 0.16; 'naming': 0.16; 'thoughts?': 0.16; 'wrote:': 0.18; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'module,': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'appear': 0.29; 'related': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'though.': 0.31; 'allows': 0.31; "i'd": 0.34; 'could': 0.34; 'received:google.com': 0.35; 'being': 0.38; 'convention': 0.38; 'e.g.': 0.38; 'guidance': 0.39; 'how': 0.40; '2nd': 0.60; 'offer': 0.62; 'name': 0.63; 'july': 0.63; 'more': 0.64; 'opinions': 0.70; '1st': 0.74; 'together,': 0.84 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:to :cc:content-type:content-transfer-encoding; bh=4HpjSi38D8Xlp+g6GqVYHgzgw3OfqgZSLrTs7Ro5zyY=; b=obY8IvWzN4Lk84f9QTxCt/Yn0nJ6xPOVd5jI1xEWN0yZUBnAlSkMp29pik6ONDHVVE TcfSo1ES2Azw7DTSr7vuijsX495MpfClVeLaj7AwmaSE3sjSE8QUOUGzWotnYp6AY8Lr 1iYHSDW2QAufy/L4UKSUjtgvqNuDYX4cbTcuQk5EFCRj7SEptFg/4OirHawNMlZx7/ba UJX6B8OIIUWwaV7Mzi3nbUmG/AqmX42O87xaeFANWvtaYSkyHfoDw1E0rzHm8nGwdS5Q sxx7mv6UDVVdP328X/78XVZPkIR1jVe1JpDgDgXrCSi8XuZq8py4y87MbGb/NkJQL9ex QhGw== MIME-Version: 1.0 X-Received: by 10.112.24.167 with SMTP id v7mr27689512lbf.19.1404844286999; Tue, 08 Jul 2014 11:31:26 -0700 (PDT) In-Reply-To: <1404831558.6942.139345801.530E4959@webmail.messagingengine.com> References: <1404831558.6942.139345801.530E4959@webmail.messagingengine.com> Date: Tue, 8 Jul 2014 19:31:26 +0100 Subject: Re: Naming conventions for functions and methods From: Arnaud Delobelle To: python@bdurham.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404844289 news.xs4all.nl 2861 [2001:888:2000:d::a6]:34692 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74198 On 8 July 2014 15:59, wrote: > > Looking for your opinions on how you name your functions and methods. Exa= mple: I have a function that hashes a file. I could name this function hash= _file() or file_hash(). The 1st naming convention sounds more natural, the = 2nd naming convention allows one to group related functions together by the= object being acted on. PEP-8 doesn't appear to offer guidance in this area= . Thoughts? Malcolm If you want to group related functions together, I would suggest putting them in a module, e.g. 'fileutils'. I'd still go for hashfile for the function name though. --=20 Arnaud