Chad Joan:

Hmmm, I don't remember python doing this. Do you mean like Java?

I meant Python. In Python when you write:

import foo

You have then to use:

foo.bar()

If you want to import just bar you have to use:

from foo import bar

There is also this syntax, used only in special situations, like when you are using the REPL:

from foo import *

That imports all the names of foo.



So I would have to write code like this:
---
import std.file, std.array, std.stdio;

void main()
{
    std.stdio.writeln(
        std.array.replace(
            cast(string)std.file.read("file.txt"),"\r\n","\n"));
}
---
instead of code like this:
---
import std.file, std.array, std.stdio;

void main()
{
    writeln(replace(cast(string)read("file.txt"),"\r\n","\n"));
}
---
???

See the solutions used in Python.

But this stuff is long settled in D, so this discussion is now academic :-)

Bye,
bearophile

Reply via email to