A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/074951.html below:

Changing global variables in tkinter/pmw callback

Changing global variables in tkinter/pmw callback Changing global variables in tkinter/pmw callbackJonathan Claggett jcc.ugm at ix.netcom.com
Fri Apr 6 20:13:16 EDT 2001
Alex wrote:
"...but the resulting confusion between items and attributes seems a strange
target to aim for."

I ought to just admit now to being overly excited by all of python's nifty
extensibility. It IS nifty, so you can hardly expect

Instead, I'll rashly claim that blurring the line between attributes and
hashes is sometimes useful when dealing with a structure whose attributes
you wish to access programmatically. One example might be a doubly linked
list where most of the code accesses the attributes directly but a generic
traverse function uses a parameter to access the attributes. My (trivial)
example:

# normal usage (using Bunch as a structure)
head = Bunch(value="cat", left=None, right=None)
tail = Bunch(value="dog", left=None, right=None)
head.right = tail
tail.left = head

# generic usage (using Bunch as a hash)
def traverse(node, next):
    while node:
        print node.value
        node = node[next]

traverse(head, "right")
traverse(tail, "left")




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4