About 50 results
Open links in new tab
  1. Python, def_init_(self): syntax error - Stack Overflow

    def __init__(self,name,age): def means you start a function (definition), and it needs a space to follow. The function __init__ is the constructor. There should always be a colon at the end of a function …

  2. What does -> mean in Python function definitions? - Stack Overflow

    Jan 17, 2013 · def foo() -> lambda hi: True: "function body" # not a type expressions Beside the first the others have no typing meaning; but it still is valid syntax to hide a lambda definition in the return …

  3. python - Error: Invalid Syntax on "def" - Stack Overflow

    Jan 16, 2014 · Error: Invalid Syntax on "def" Asked 14 years, 8 months ago Modified 12 years, 2 months ago Viewed 31k times

  4. python - Why do I get "SyntaxError: invalid syntax" in a line with ...

    Why do I get "SyntaxError: invalid syntax" in a line with perfectly valid syntax? Asked 11 years, 10 months ago Modified 1 year, 7 months ago Viewed 1.3m times

  5. How can I use a global variable in a function? - Stack Overflow

    Jul 11, 2016 · How do I create or use a global variable inside a function? How do I use a global variable that was defined in one function inside other functions? Failing to use the global keyword where …

  6. Python def marked as invalid syntax - Stack Overflow

    Jul 4, 2014 · Python def marked as invalid syntax [closed] Ask Question Asked 11 years, 9 months ago Modified 11 years, 9 months ago

  7. language agnostic - What is a lambda (function)? - Stack Overflow

    Aug 19, 2008 · A regular function will be defined with the syntax "def", then we type in the name and settle the interface with " ()" and ending our definition by the syntax ":". Now we enter the functions …

  8. What does the "at" (@) symbol do in Python? - Stack Overflow

    def bar(): pass bar = foo(bar) They are not exactly the same because Python evaluates the foo expression (which could be a dotted lookup and a function call) before bar with the decorator (@) …

  9. Understanding Python super() with __init__() methods

    Feb 23, 2009 · Why is super() used? Is there a difference between using Base.__init__ and super().__init__? class Base(object): def __init__(self): print "Base created&quot ...

  10. What should I do with "Unexpected indent" in Python?

    def test_function(): if 5 > 3: print "hello" You may also have a mix of tabs and spaces in your file. I suggest you use a Python syntax aware editor, like PyScripter, or NetBeans.