Discussion:
questions about how sysfs.py works
Guy Streeter
2014-08-28 22:01:19 UTC
Permalink
I'm making an effort to understand how all of tuna works (this is admirable,
not folly, correct?). There's a part of the reload() function in the cpus
class that I don't understand. to start with:

for socket in sockets_to_sort:
self.sockets[socket].sort()

Here self.sockets[socket] is a list of cpu objects. The cpu class is not an
orderable type. It does not provide it's own comparison function, and cannot
be converted to an integer value. What is the (intended) result of calling
the list's sort() function?

Another thing: these lines are indented so as to be included in the outer
loop. It seems these lines need only to be run after the other loop is complete.

I think I must be missing something, since the code seems to work. Although,
I can't find any place that depends on self.sockets[socket] being sorted in
any meaningful way.

thanks,
- --Guy
Guy Streeter
2014-10-29 18:47:15 UTC
Permalink
Post by Guy Streeter
I'm making an effort to understand how all of tuna works (this is
admirable, not folly, correct?). There's a part of the reload() function
for socket in sockets_to_sort: self.sockets[socket].sort()
Here self.sockets[socket] is a list of cpu objects. The cpu class is not
an orderable type. It does not provide it's own comparison function, and
cannot be converted to an integer value. What is the (intended) result of
calling the list's sort() function?
Another thing: these lines are indented so as to be included in the
outer loop. It seems these lines need only to be run after the other loop
is complete.
I think I must be missing something, since the code seems to work.
Although, I can't find any place that depends on self.sockets[socket]
being sorted in any meaningful way.
thanks, --Guy
I realize this isn't of high importance, but it's bugging me that I don't
understand this bit of code. Does anyone have any insight?
thanks,
- --Guy
Arnaldo Carvalho de Melo
2014-10-29 21:19:31 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Guy Streeter
I'm making an effort to understand how all of tuna works (this is
admirable, not folly, correct?). There's a part of the reload() function
for socket in sockets_to_sort: self.sockets[socket].sort()
Here self.sockets[socket] is a list of cpu objects. The cpu class is not
an orderable type. It does not provide it's own comparison function, and
cannot be converted to an integer value. What is the (intended) result of
calling the list's sort() function?
Another thing: these lines are indented so as to be included in the
outer loop. It seems these lines need only to be run after the other loop
is complete.
I think I must be missing something, since the code seems to work.
Although, I can't find any place that depends on self.sockets[socket]
being sorted in any meaningful way.
thanks, --Guy
I realize this isn't of high importance, but it's bugging me that I don't
understand this bit of code. Does anyone have any insight?
It just that after all those years, I'm back where you are, i.e. having
to go the code to try to figure out how it works, not a good sign, huh?

- Arnaldo

Loading...