Re: [PATCH - hwmixvolume 4/9] hwmixvolume: use a with context to open files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Aug 14 2018 12:59, Takashi Sakamoto wrote:
If you use Python 2.5 or later, you can use 'file()' instead of 'open()'. Furthermore, FILE object returned by 'file()' (or 'open()') supports 'iterator' and you have no need to call '.readlines()' anymore,
thus:

```
 > +            with file(filename, "r") as f:
 > +                for line in f:
...
```

Oops. The 'file()' is removed at Python 3.0[1]...

[1] https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins


Regards

Takashi Sakamoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux