> Please bring English muffins with you :) You like (American) English muffins? :-)
<Amaya> helix: english muffins! <helix> Amaya: I don t think US english muffins are any good, but I could be wrong
It requires PyGTK,
Python Glade2 and
Python Glade2 and
python-tunepimp.
You can even run it on Windows (Don't ask me for help on that!
Get ActivePython, PyGTK for Windows, Python tunepimp bindings and either
compile all the libraries yourself or copy them from the latest Picard beta.
Note that there is a memory leak somewhere in windows only, probably in the
libs and not in the python code)
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover texts
being "A GNU Manual," and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
"GNU Free Documentation License."
(a) The FSF's Back-Cover Text is: "You have freedom to copy and
modify this GNU Manual, like GNU software. Copies published by
the Free Software Foundation raise funds for GNU development."
class odd:
def __init__(self, a, b= ):
self.b = b
self.b["a"]=a
one = odd(1)
two = odd(2)
print one.b["a"]
That code looks reasonable, doesn't it? The parameter "a" is required, but
other parameters can be given in a hash. So what output would you expect?
The output is 2. The reason is as follows:
Python creates an empty hash, and b is a reference to this hash per
default. To the same hash each time. So the code is basically equivalent to
class odd2:
default_for_b_in_init =
def __init__(self, a, b=default_for_b_in_init):
self.b = b
self.b["a"]=a
and not (as I had expected):
class odd3:
def __init__(self, a, b=None):
if not b: b =
self.b = b
self.b["a"]=a
Obviously, both behaviours make sense, and the python way is somewhat
consequenter.
So be careful when using default values in functions!
Non-reference types such as integers are fine, so is None, and of course
any outside objects you want to be the same for each call. Don't assume
the def statement will create any new object.
Even shorter example:
def test(a, b= ):
print b
b["a"]=a
test(1)
test(2)
will result in the output
'a': 1again there is only a single hash b.
with a small problem at the top edge of screen due to lack of space there.
Update: Level 15 in 14:01 Minutes. The schema works perfectly, you have to
touch each node at most twice (once when discovering, and maybe switch place
with a sibling when discovering the new neighbours). All changes are local,
and you don't actually look at the lines, just at the colored nodes.
Unless of course you run out of space and have to rearrange.
set a b
You don't have to quote things - they default to strings - the variable 'a' now contains the value 'b'.
set lst a b c d e
No fiddling around with lots of syntax - the above is defined as a string (we could have used "" to group the words), but it gets turned into a list
llength $lst
5
Things are automatically converted into the type you want to work with. Of course, this also makes it really easy to work with code as strings and vice versa:
proc until cond code
while 1
uplevel $code
if [uplevel [list expr $cond]] return
set i 0
until $i == 10
puts "i is $i"
incr i
and so on and so forth.
Ruby (and Python) handles things a bit differently than Tcl does. Even though it's still very dynamic, it is more strongly typed:
"5" + 5 # error
Whereas the same code runs just fine in Tcl - "5" is transformed into a number, because if the programmer is trying to add to it, they must want it to be a number. On the other hand, strong typing can help catch errors, may help make things clearer, and in corner cases, probably helps catch nasty surprises.
One of the things that Tcl's system facilitates, at least with simple types (lists, strings, numbers, dicts) is 'marshalling' or 'serializing'. Want to send a hash table down a socket?
puts $sk $mydict
# And on the other side:
gets $localsk mydict
dict get $mydict key
When you start treating it as a dictionary, it "just turns into one" - or throws an error. Good programmers will check for errors, but that goes for whatever language you use. This often comes in handy for code-creation, as well - it's very easy to build up a string programmatically and then evaluate it, much as you might do with a list in Lisp.
It also makes coding short scripts... well, shorter, because you don't have to fiddle around telling the language what you mean, in most cases. Treat it like how you want to use it, and it will work out what you want to do.
Hecl
Hecl comes into the picture, because I've borrowed a lot of design ideas from Tcl, but the language is still used by only a few people, so we're free to hack on it and change things that we don't like about Tcl. Lately, we've been having an interesting debate on the merits of Tcl style weak typing, vs stronger Ruby-style typing, as well as the string representation you get when you attempt to print a type:
http://sourceforge.net/mailarchive/message.php?msg_id=15254941
http://sourceforge.net/mailarchive/message.php?msg_id=15254942
There are certainly some things that could be improved in Tcl's way of dealing with things - one area where it doesn't do so well is in dealing with NULL values - you can't really deal with that in a string, because a blank string is different from no value at all.
Wolfgang would like to go towards more Ruby-style values. I'm willing to consider most anything at this stage, because it's interesting, and I like going over the possibilities, in order to make Hecl as useful as possible. "Everything is a string" has its limits in Tcl, in any case, because what ends up happening is that 'complex' types (files, say), are tied, via a hash table, to the C struct that actually implements them, meaning that the string representation is really only a pointer to something else, and isn't "meaningful", as it is with lists or dicts.
I think, though, that in this case I'll mostly want to keep types weak/dynamic, as Hecl aims to be a complement, not a replacement for Java, so in many cases, I'd rather see it make nearly the opposite design decision, where it's reasonable.
We'll see, though, who knows what 'type' of interesting compromise we might end up with. Of course, I'm always happy to see new people join the discussion.
Next.