Ask Your Question
0

'DeprecationWarning' when using list comprehension

asked 2020-06-13 09:58:33 +0100

banksiaboy gravatar image

updated 2020-06-14 13:52:20 +0100

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

edit retag flag offensive close merge delete

Comments

markup keeps failing :-(

banksiaboy gravatar imagebanksiaboy ( 2020-06-13 10:03:51 +0100 )edit

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

is ok

banksiaboy gravatar imagebanksiaboy ( 2020-06-13 10:14:21 +0100 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2020-06-13 10:26:54 +0100

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.

edit flag offensive delete link more

Comments

OK, Thank-you.

banksiaboy gravatar imagebanksiaboy ( 2020-06-14 21:39:10 +0100 )edit

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: 2020-06-13 09:58:33 +0100

Seen: 261 times

Last updated: Jun 14 '20