Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > cn.bbs.comp.lang.python > #1

Re: python里有内联函数的概念么?

Newsgroups cn.bbs.comp.lang.python
Date 2015-11-17 21:53 -0800
References <5BDHOb$cXS@newsmth.net>
Message-ID <9c186378-1efa-4d31-b6cf-18cbf80b88e8@googlegroups.com> (permalink)
Subject Re: python里有内联函数的概念么?
From tianma201211@gmail.com

Show all headers | View raw


On Sunday, April 8, 2012 at 9:10:03 PM UTC+8, 曾经沧海难为水 wrote:
> 在一个大循环里根据不同的条件频繁调用某几个简单函数。
> 如果循环里用if elif直接展开函数体代码太冗余了。如果调用函数开销有点大。
> 有没有c++类似的内联函数,外部定义一个个内联函数
> --
>  [s [1;9H [1;5;31mBlackMask  [m( [1;35m曾 [1;33m经 [32m沧 [31m海难 [36m为 [34m水 [m [u
> 
> 
>  [m [1;37m※ 来源:·水木社区 newsmth.net·[FROM: 125.118.25.*] [m

可以用lambda吧,要是追求效率可以考虑非cpython。

Back to cn.bbs.comp.lang.python | Next | Find similar


Thread

Re: python里有内联函数的概念么? tianma201211@gmail.com - 2015-11-17 21:53 -0800

csiph-web