Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106004
| Path | csiph.com!xmission!feeder.erje.net!2.eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Vito De Tullio <vito.detullio@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer |
| Date | Tue, 29 Mar 2016 23:36:05 +0200 |
| Lines | 28 |
| Message-ID | <mailman.168.1459287378.28225.python-list@python.org> (permalink) |
| References | <56f9cffb$0$1614$c3e8da3$5496439d@news.astraweb.com> <nddigv$74u$1@ger.gmane.org> <56FA565A.9020800@mail.de> <56FAA22E.3040805@mail.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Trace | news.uni-berlin.de gNRPsK2wut3gFO/vWfnuVAdC715vOIAfP9+jr2f48hxw== |
| 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:: [': 0.03; 'subject:Python': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'syntax': 0.13; 'mylist': 0.16; 'readable': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'subject:Learning': 0.16; 'subject:programmer': 0.16; 'wrote:': 0.16; 'subject:] ': 0.19; '>>>': 0.20; 'not,': 0.22; 'select': 0.23; 'bit': 0.23; "python's": 0.23; 'this:': 0.23; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:" 20': 0.26; 'equivalent': 0.27; 'question': 0.27; 'subject:) ': 0.32; '"")': 0.33; 'foo': 0.33; 'similar': 0.33; 'mine': 0.35; 'something': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'where': 0.40; 'relatively': 0.63; 'more': 0.63; 'friend': 0.81; 'subject:you': 0.85; 'received:2': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | 2.193.37.81 |
| User-Agent | KNode/4.14.10 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| 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> |
| Xref | csiph.com comp.lang.python:106004 |
Show key headers only | View raw
Sven R. Kunze wrote:
>>> My question to those who know a bit of C#: what is the state-of-the-art
>>> equivalent to
>>>
>>> "\n".join(foo.description() for foo in mylist
>>> if foo.description() != "")
> Friend of mine told me something like this:
>
> String.Join("\n", mylist.Where(foo =>
> !String.IsNullOrEmpty(foo.description)).Select(foo => foo.description))
I don't know if is "better" or not, but I find more readable using the
"sql"-like syntax
string.Join("\n", from foo in mylist
where !string.IsNullOrEmpty(foo.description())
select foo.description());
which is relatively similar to the python's comprehension.
--
By ZeD
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Learning Python (or Haskell) makes you a worse programmer Steven D'Aprano <steve@pearwood.info> - 2016-03-29 11:44 +1100
Re: Learning Python (or Haskell) makes you a worse programmer Ethan Furman <ethan@stoneleaf.us> - 2016-03-28 21:05 -0700
Re: Learning Python (or Haskell) makes you a worse programmer Michael Torrie <torriem@gmail.com> - 2016-03-28 22:13 -0600
[OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer Peter Otten <__peter__@web.de> - 2016-03-29 11:39 +0200
Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-29 12:05 +0200
Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-29 12:18 +0200
Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-29 17:41 +0200
Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer Peter Otten <__peter__@web.de> - 2016-03-29 18:05 +0200
Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-29 18:11 +0200
Re: [OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer Vito De Tullio <vito.detullio@gmail.com> - 2016-03-29 23:36 +0200
Re: Learning Python (or Haskell) makes you a worse programmer "Eric S. Johansson" <esj@harvee.org> - 2016-03-29 19:29 -0400
Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-30 12:07 +0200
Re: Learning Python (or Haskell) makes you a worse programmer BartC <bc@freeuk.com> - 2016-03-30 11:21 +0100
Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-30 13:43 +0200
Re: Learning Python (or Haskell) makes you a worse programmer "Eric S. Johansson" <esj@harvee.org> - 2016-03-30 09:06 -0400
Re: Learning Python (or Haskell) makes you a worse programmer Chris Angelico <rosuav@gmail.com> - 2016-03-31 00:09 +1100
Re: Learning Python (or Haskell) makes you a worse programmer "Eric S. Johansson" <esj@harvee.org> - 2016-03-30 09:37 -0400
Re: Learning Python (or Haskell) makes you a worse programmer Tim Golden <mail@timgolden.me.uk> - 2016-03-30 11:14 +0100
Re: Learning Python (or Haskell) makes you a worse programmer Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-31 10:36 +1300
Re: Learning Python (or Haskell) makes you a worse programmer Travis Griggs <travisgriggs@gmail.com> - 2016-03-31 09:30 -0700
Re: Learning Python (or Haskell) makes you a worse programmer Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-31 10:34 -0600
Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-31 18:44 +0200
Re: Learning Python (or Haskell) makes you a worse programmer "Sven R. Kunze" <srkunze@mail.de> - 2016-03-30 12:23 +0200
csiph-web