The = sign suggests to Python the this is a keyword parameter, no a positional one. Since the component to the left of the = is one expression test<"info"> you acquire the error.
You are watching: Keyword can t be an expression
The factor for not allowing assignment in Python expressions is a common, hard-to-find bug in those various other languages, led to by this construct:
if (x = 0) // error handlingelse // password that just works for nonzero xSource : http://docs.python.org/faq/design.html#why-can-t-i-use-an-assignment-in-an-expression
I think what you desire to carry out is to happen it together a glob type.
show(*test) law this friend must match your arg signature so check will have to be characterized as
test = "d" : Trueor show will need to be
Because usually it provides no sense. What execute you want to obtain from that? Assignment doesn"t return a value.
Let"s think the a couple of possibilities:The expression need to be passed together a duty - you need to use lambda, or produce an really function.The expression should return a boolean for success - Python raises exception on failure, examine for those instead.The expression should give None - over there is no worth to this.
Either way, what you room trying to execute doesn"t do sense.
Thanks because that contributing solution to stack Overflow!Please be certain to answer the question. Provide details and share your research!
But avoid …Asking for help, clarification, or responding to other answers.Making statements based upon opinion; earlier them up with referrals or personal experience.
See more: Young Frankenstein Puttin On The Ritz, Putting On The Ritz Young Frankenstein Gifs
To find out more, check out our advice on writing great answers.
write-up Your prize Discard
Not the prize you're spring for? Browse various other questions tagged python python-2.7 or ask your own question.
site design / logo © 2021 ridge Exchange Inc; user contributions licensed under cc by-sa. Rev2021.9.24.40305