[albatross-users] more data tricks for the wiki

Eric S. Johansson esj at harvee.org
Thu Jul 3 23:32:19 EST 2003


Matt Goodall wrote:

[... redundant parts removed...]
>> The user shouldn't have to care that it's an iterator when the 
>> surrounding structure looks like a simple for loop.  if appearances 
>> are deceiving, the user will resent being deceived. 
> 
> 
> Hmm, that's an interesting point. Perhaps the *real* problem is that the 
> tag is called <al-for> but doesn't behave like a Python for loop. 
> Perhaps something like <al-iterate>would be better?

that's the complete point.  The appearances must match the metaphor in order for 
it to assist in the user's learning process and the expert's use process.

now, researching the concept of iterators in Python, I found this nice little 
article: http://gnosis.cx/publish/programming/charming_python_b1.html

In which, the author says " Most frequently, however, one is likely to use a 
generator as an iterator, which is even more concise (and again looks just like 
an old-fashioned sequence):"

this article and seeing how albatross uses the iterator concept reinforces that 
iterator is primarily used as a way of encapsulating sequencing behavior across 
a set of data.

what's interesting is the difference in terms of what is returned.  An 
albatross, it's an iterator object; in Python iterators (as demonstrated by 
examples in the article referenced above) it's an ordinary piece of data 
(integer, float, string etc.).

I'm beginning to understand one of my cognitive speed bumps.  The data source 
for the loop is usually some form of sequence.  It appears that the albatross 
for loop structure tries to cram the sequence into an iterator and then impose 
its iterator view.

as for making a new tag, I don't think it's necessary.  I would consider 
expanding the definition of a <al-for> loop however.  Personally, I would do 
something like:

<al-for index="eggs" expr="sequence" >

for ordinary sequences but for the cases where you want an iterator, you can use 
the current albatross form.

---eric





More information about the Albatross-users mailing list