Skip to content

Instantly share code, notes, and snippets.

@dketov
Created December 13, 2011 14:16
Show Gist options
  • Save dketov/1472265 to your computer and use it in GitHub Desktop.
Save dketov/1472265 to your computer and use it in GitHub Desktop.
Вызов функции
# -*- encoding: utf-8 -*-
"""
Прямой вызов функции
"""
print pow(2,3)
print 10 + pow(2, 3*5)/3.0
print abs(-10)
print round(1.0/2.0)
# -*- encoding: utf-8 -*-
"""
Вызов функции через apply()
"""
def func(x, y, z): return x + y + z
print apply(func, (2, 3, 4))
f = lambda x, y, z: x + y + z
print apply(f, (2, 3, 4))
args = (2,3) + (4,)
print args
def func(x, y, z): return x + y + z
apply(func, args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment