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


Groups > comp.lang.python > #76595

More Pythonic implementation

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <tomarshubham24@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.391
X-Spam-Level ***
X-Spam-Evidence '*H*': 0.51; '*S*': 0.29; 'def': 0.12; 'poker': 0.16; 'pythonic': 0.16; 'subject:More': 0.16; 'lets': 0.24; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'subject:skip:i 10': 0.31; 'another': 0.32; 'received:google.com': 0.35; 'thanks': 0.36; 'hi,': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'highest': 0.39; 'to:addr:python.org': 0.39; 'more': 0.64; 'hand': 0.80; 'rank.': 0.84; 'hand,': 0.93; 'hands': 0.96; 'ranking': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=U3o525GxY1yQkPhzUtSrO89gENFSzFWZT3px0hk/suo=; b=DzfBweDazgyB9i6f5Ycrnt+02hEmrVMqGSumiPbmhGJdr0dbmX9qbBmEJyw7Z4nb0Y +RRxIG3I951Zh8WMicnskwa4caIylyZRwmuYNBBFx1LAwF+H7N/rDuTivWvPq7A4eXmN JiR5G+YiUwisR008mdZiW8R7t2f4xzPekZihHapVK98yc0mKNiMYaOOIk61Y0dH76FQG 5PSOZHNp45DK1/OK4VswEAvH7EqQ+jm9FPCIQWueCUbv436o4vNFTf4BGdn6gvUNsPlP EIqcvfPiy2Wgv3G/DzS/S/RLrR/N6ca7898rLfd5QK2CUDqqovlhF6BTxeOm2j04yyWV vmxQ==
MIME-Version 1.0
X-Received by 10.182.60.98 with SMTP id g2mr44851841obr.6.1408468159856; Tue, 19 Aug 2014 10:09:19 -0700 (PDT)
Date Tue, 19 Aug 2014 22:39:19 +0530
Subject More Pythonic implementation
From Shubham Tomar <tomarshubham24@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=089e0158aaa05887aa0500fe8cc9
X-Mailman-Approved-At Tue, 19 Aug 2014 20:39:50 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.13161.1408473590.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408473590 news.xs4all.nl 2887 [2001:888:2000:d::a6]:42578
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76595

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

Lets say I have a function poker(hands) that takes a list of hands and
returns the highest ranking hand, and another function hand_rank(hand) that
takes hand and return its rank. As in Poker
http://www.pokerstars.com/poker/games/rules/hand-rankings/.

Which of the following is better and more Pythonic ?

def poker(hands):
    return max(hands, key=hand_rank)

or

def poker(hands):
    return max(hand_rank(hands))

Thanks

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


Thread

More Pythonic implementation Shubham Tomar <tomarshubham24@gmail.com> - 2014-08-19 22:39 +0530
  Re: More Pythonic implementation Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-08-20 17:52 +0200

csiph-web