Translation in python of C++ idiom
Francois Petitjean
francois.petitjean at noos.fr
Fri Aug 9 11:57:22 EDT 2002
More information about the Python-list mailing list
Fri Aug 9 11:57:22 EDT 2002
- Previous message (by thread): Translation in python of C++ idiom
- Next message (by thread): Translation in python of C++ idiom
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In a paper entitled "Minimalism: Omit Needless Code" (1), Kevlin Henney advocates a concise coding style and for instance the following snippet : typedef std::istream_iterator<std::string> in; std::cout << std::distance(in(std::cin), in()); is given to print the number of words in a textfile or stream. And by replacing the typedef by typedef std::istreambuf_iterator<char> in; we count chars. To print the number of lines : typedef std::istreambuf_iterator<char> in; std::cout << std::count(in(std::cin), in(), '\n'); So, what would be the equivalent in Python? Regards. (1) http://www.two-sdg.demon.co.uk/curbralan/papers/minimalism/OmitNeedlessCode. html
- Previous message (by thread): Translation in python of C++ idiom
- Next message (by thread): Translation in python of C++ idiom
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list