Why the hell doesn't foreach decode strings

Martin Nowak dawg at dawgfoto.de
Fri Oct 21 20:45:50 PDT 2011


On Sat, 22 Oct 2011 01:28:28 +0200, bearophile <bearophileHUGS at lycos.com>  
wrote:

> so:
>
>> IMO people are spoiled by dynamic languages
>
> We should aim to something *better* than dynamic languages, where  
> possible. If you have to do certain things (even "slow" ones), there's  
> no point in making them harder than necessary in D.
>
> Python is a good language, but it's not perfect, and in a new language  
> I'd like something even better. D contains several small things that are  
> better than Python (an many things that are worse than Python).
>
> Bye,
> bearophile

Well the first thing I tried out was:

#!/usr/bin/env python
for c in "f#a# ∞":
     print c

Which I still didn't get to run after:

  - reading SyntaxError: Non-ASCII character '\xe2' in file ./run.py on  
line 1, but no encoding declared; see  
http://www.python.org/peps/pep-0263.html for details
  - adding a BOM to the script
  - remove the shebang which collides with the BOM
  - writing unicode("f#a# ∞") so I don't get an encoding error

martin


More information about the Digitalmars-d mailing list