代码之家  ›  专栏  ›  技术社区  ›  Lukas Cenovsky

编写C语言的Python程序员的建议#

  •  4
  • Lukas Cenovsky  · 技术社区  · 15 年前

    question 关于给编写Python代码的C#程序员的建议,但我的方向相反。

    对于编写C代码的Python程序员,有哪些技巧、技巧和注意事项?

    1 回复  |  直到 9 年前
        1
  •  2
  •   Lukas Cenovsky    9 年前

    以下是我的问题所指的一些例子:

    • enumerate() in C#

      另一种可能性:

      "abc".Where((x,i) => true).Select((x, i) => string.Format("{0}: {1}", i, x))
      
      0: a
      1: b
      2: c
      
    • list comprehension in C#

      List<Foo> fooList = new List<Foo>();
      IEnumerable<Foo> extract = from foo in fooList where foo.Bar > 10 select Foo.Name.ToUpper();