About 214,000 results
Open links in new tab
  1. Funções em Python-Variáveis globais e locais - Stack Overflow em ...

    Jul 6, 2018 · Em Python, as variáveis declaradas dentro de funções são tratadas como atributos dentro de objetos, e esses atributos podem ser acessados a partir do escopo global usando o …

  2. python - Is there a way to delete created variables, functions, etc ...

    Oct 24, 2014 · I just didn't know that there is a del function out there. I'm beginning to learn Python and often have to experiment in the shell, so standard variable names like x or y are …

  3. python - Short description of the scoping rules - Stack Overflow

    Nov 15, 2008 · Actually, a concise rule for Python Scope resolution, from Learning Python, 3rd. Ed.. (These rules are specific to variable names, not attributes. If you reference it without a …

  4. Crear variables globales en Python - Stack Overflow en español

    Jul 19, 2019 · Yo soy bastante nuevo con la sintaxis de Python en particular como crear global, nonlocal y local variables y como declararlas sin errores de sintaxis. Por ejemplo en el …

  5. How to get/set local variables of a function (from outside) in …

    Jul 19, 2011 · Expecting a variable in a function to be set by an outside function BEFORE that function is called is such bad design that the only real answer I can recommend is changing …

  6. Local variable referenced before assignment in Python

    Jul 7, 2013 · Use global statement to handle that: def three_upper(s): #check for 3 upper letter global count for i in s: From docs: All variable assignments in a function store the value in the …

  7. Why does python think this is a local variable? - Stack Overflow

    Sep 21, 2010 · This is just how Python works: Assignment always binds the left-hand side name in the closest surrounding name space. Inside of a function the closest namespace is the local …

  8. python - Why do I get a "referenced before assignment" error …

    See Python reference. You should declare variable without global and then inside the function when you want to access global variable you declare it global yourvar.

  9. How can I access global variable inside class in Python

    May 30, 2012 · The statement tells the Python compiler that any assignments (and other binding actions) to that name are to alter the value in the global namespace; the default is to put any …

  10. How to create module-wide variables in Python? - Stack Overflow

    Dec 30, 2009 · If you assign the variable without the global keyword then Python creates a new local var -- the module variable's value will now be hidden inside the function.

Refresh