Python does it, so are we...

On 01/03/2013 03:22, joker-eph wrote:
> In pythran/pythonic++/core/file.h:
> 
>> +
>> +			struct _file{
>> +					FILE* f;
>> +					_file() : f(nullptr) {}
>> +					_file(core::string const& filename, core::string const& strmode = "r") : f(fopen(filename.c_str(), strmode.c_str())){}
>> +					FILE* operator*() const {return f;}
>> +					~_file() {if(f) fclose(f);}
>> +			};
>> +
>> +			class file {
>> +
>> +                typedef _file container_type;
>> +                impl::shared_ref<container_type> data; 
>> +					private:
>> +				bool is_open;
>> +				core::string mode, name, newlines;
> 
> String manipulation is "bad", use an enum for the different modes? Or a
> bit set?
> 
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/serge-sans-paille/pythran/pull/53/files#r3199752>.
>