Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56553
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'none:': 0.07; 'function,': 0.09; 'naturally': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'try:': 0.09; 'jan': 0.12; 'awkward,': 0.16; 'callable': 0.16; 'func': 0.16; 'indexerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'slice.': 0.16; 'index': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'thu,': 0.19; 'example': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'list:': 0.30; "i'm": 0.30; 'crash': 0.31; 'maybe': 0.34; 'except': 0.35; 'something': 0.35; 'but': 0.35; 'useful': 0.36; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'received:173': 0.61; 'more': 0.64; 'effectively': 0.66; 'received:fios.verizon.net': 0.84; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Python's and and Pythons or |
| Date | Thu, 10 Oct 2013 03:43:15 -0400 |
| References | <91180c35-413f-4b65-a224-917d8d68b7ec@googlegroups.com> <a471eecd-2e9f-4d32-8825-bdc088a0ecb0@googlegroups.com> <CAPTjJmrnw9kSuCG0cJrNeGF7A=ge-R0izj75J1QTTBHkPtNuyw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
| In-Reply-To | <CAPTjJmrnw9kSuCG0cJrNeGF7A=ge-R0izj75J1QTTBHkPtNuyw@mail.gmail.com> |
| 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.927.1381391010.18130.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381391010 news.xs4all.nl 15930 [2001:888:2000:d::a6]:41912 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56553 |
Show key headers only | View raw
On 10/10/2013 2:45 AM, Chris Angelico wrote: > On Thu, Oct 10, 2013 at 5:12 PM, Peter Cacioppi > <peter.cacioppi@gmail.com> wrote: >> I'm trying to think of a good example usage of echo-argument and. Maybe something like >> A bit awkward, echo-argument or is more naturally useful to me then echo-argument and. > > first_element = some_list[0] # Oops, may crash some_list[0:1] always works, and sometimes is usable, but you still cannot index the slice. > try: > first_element = some_list[0] > except IndexError: > firstelement = None # A bit verbose > > first_element = some_list and some_list[0] > > # or if you want a zero instead of an empty list: > first_element = len(some_list) and some_list[0] > > > Also, consider the case where you have a function, or None: > > result = func(*args,**kwargs) # NoneType is not callable > > result = func and func(*args,**kwargs) y = x and 1/x One just has to remember that y==0 effectively means y==+-infinity ;-). -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python's and and Pythons or Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-09 16:54 -0700
Re: Python's and and Pythons or Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-10 00:36 +0000
Re: Python's and and Pythons or Chris Angelico <rosuav@gmail.com> - 2013-10-10 12:13 +1100
Re: Python's and and Pythons or Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-09 23:12 -0700
Re: Python's and and Pythons or Chris Angelico <rosuav@gmail.com> - 2013-10-10 17:45 +1100
Re: Python's and and Pythons or Ethan Furman <ethan@stoneleaf.us> - 2013-10-09 23:46 -0700
Re: Python's and and Pythons or Terry Reedy <tjreedy@udel.edu> - 2013-10-10 03:43 -0400
Re: Python's and and Pythons or Chris Angelico <rosuav@gmail.com> - 2013-10-10 19:03 +1100
Re: Python's and and Pythons or Ethan Furman <ethan@stoneleaf.us> - 2013-10-10 06:33 -0700
Re: Python's and and Pythons or Terry Reedy <tjreedy@udel.edu> - 2013-10-10 21:41 -0400
Re: Python's and and Pythons or Ethan Furman <ethan@stoneleaf.us> - 2013-10-10 19:47 -0700
Re: Python's and and Pythons or Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-09 23:55 -0700
csiph-web