On Mon, Sep 2, 2013 at 1:24 AM, Antoine Pitrou <solip...@pitrou.net> wrote:
> Le Sun, 1 Sep 2013 18:02:30 -0700, > Eli Bendersky <eli...@gmail.com> a écrit : > > Hello, > > > > I was looking at the possibility of replacing the SEEK_* constants by > > IntEnums, and the first thing that catches attention is that these > > constants are defined in both Lib/os.py and Lib/io.py; both places > > also recently started supporting SEEK_HOLE and SEEK_DATA (though here > > io refers to os.SEEK_HOLE and os.SEEK_DATA). > > What is the runtime cost of doing so? os is a fundamental module that is > imported by almost every Python program. > Theoretically, it should be very low given that we just need to add an import and define one class. os already does a number of things in its toplevel (mostly a few imports which transitively do other things). Compounded with import caching, since this is done just once per run, doesn't seem like a problem. Empirically, I tried measuring it but I can't discern a difference with/without translating SEEK_* to enums. There's a fluctuation of ~1usec which I can't distinguish from noise. Let me know if you have a good methodology of benchmarking these things Eli
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com