>          @ftp.retrbinary("RETR "+@path,4) do |block|
>             print "CALLBACK ",block,"\n"
>             callcc{|@iter| @flag=true}
>             if @flag
>                @flag=false
>                return block
>             end
>          end

Hi Robert, 

I guess you are running into some threading/synching of Net::FTP here. 
Simply put, the pattern works, although it is harder to manage properly 
than one might think: 

  # A small cc demo on the topic of IO. Of course there is 
  # File#readline doing the same job as this fabulously, this 
  # is just for demonstration.
  #
  class CCFile
    def initialize
      @file = File.open(__FILE__, 'r+')
      @cc = nil
    end

    def read
      @cc.call if @cc && !@file.eof?
      @file.each do |line|
        puts line
        callcc do |cc|
          @cc = cc
          return line
        end
      end
    end
  end

  f = CCFile.new
  2.times do 
    f.read
  end
  # let the files close themselves

You have probably remarked that the @flag variable isn't strictly 
neccessary. Is that something like what you are trying to do ? 

Also note the interaction with the loop. This is why cc's are not widely 
used...

Keep going, you are on the right track. I can't comment on your Python, 
since I am a total n00b in Python. 

best whishes, 
k
software manufaktur - rubylab.newfoundedpower.com