News for hackers. Stuff that matters.
Re:Why Hy? by gilch on Tuesday May 03, 2022 @04:23PM (#31253107)
It works if you disambiguate your namespaces:

    >>> a = 1
    >>> def foo():
    ...     a = globals()['a']
    ...     print(a)
    ...
    >>> foo()
    1
Still yuck?
Re:Why Hy? by gilch on Wednesday May 04, 2022 @06:22PM (#31266628)
Here's another way to do it:

  >>> def foo():
  ...     import __main__
  ...     a = __main__.a
  ...     print(a)
  ...
  >>> foo()
  1