Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Python only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
Python
newbie question: apply()
Collapse
This topic is closed.
X
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
TK
#1
newbie question: apply()
Oct 4 '08, 09:35 AM
HI,
I need an example for the usage of the apply()-function. Can you help me?
Thanks.
o-o
Thomas
Chris Rebert
#2
Oct 4 '08, 09:45 AM
Re: newbie question: apply()
On Sat, Oct 4, 2008 at 2:25 AM, TK <tokauf@web.dew rote:
HI,
>
I need an example for the usage of the apply()-function. Can you help me?
Don't use the apply() function, it's deprecated and unnecessary thanks
to Python's enhanced calling syntax, which is described in depth on
Welcome to Python.org
http://www.python.org/doc/2.5.2/ref/calls.html
The official home of the Python Programming Language
apply() was used to call an arbitrary function with arbitrary arguments.
This can now be done by e.g:
pos_args = ["spam", 1, [3]]
kwd_args = {"b":7, "c":9}
result = some_function(* pos_args, **kwd_args)
Which is equivalent to:
result = some_function(" spam", 1, [3], b=7, c=9)
Which was equivalent to:
result = apply(some_func tion, pos_args, kwd_args)
Cheers,
Chris
>
Thanks.
>
o-o
>
Thomas
--
Mailman 3 Info | python-list@python.org - python.org
http://mail.python.org/mailman/listinfo/python-list
>
--
Follow the path of the Iguana...
Blog — chrisrebert.com
http://rebertia.com
Comment
Post
Cancel
TK
#3
Oct 4 '08, 09:55 AM
Re: newbie question: apply()
pos_args = ["spam", 1, [3]]
kwd_args = {"b":7, "c":9}
result = some_function(* pos_args, **kwd_args)
>
Which is equivalent to:
result = some_function(" spam", 1, [3], b=7, c=9)
>
Which was equivalent to:
result = apply(some_func tion, pos_args, kwd_args)
Thanks a lot.
o-o
Thomas
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment