First time here? Check out the FAQ!

Ask Your Question
0

'DeprecationWarning' when using list comprehension

asked 4 years ago

banksiaboy gravatar image

updated 4 years ago

FrédéricC gravatar image

input_range = srange(-3,3,.02)

[sigmoid(x) for x in input_range]

gives warning:

DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
    See _blah_ trac.sagemath.org/5930 for details.

Am I really doing something wrong here?

List comprehension syntax is prefered idiom in Python AFAIK

Preview: (hide)

Comments

markup keeps failing :-(

banksiaboy gravatar imagebanksiaboy ( 4 years ago )

list_plot(list(map(sigmoid,input_range)))

is ok

banksiaboy gravatar imagebanksiaboy ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 4 years ago

Sébastien gravatar image

The deprecation message is trying to tell you to do:

[sigmoid(x=x) for x in input_range]

where x= is the name of the symbolic variable inside of the expression sigmoid.

Preview: (hide)
link

Comments

OK, Thank-you.

banksiaboy gravatar imagebanksiaboy ( 4 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 286 times

Last updated: Jun 14 '20