AWhetter <ash...@awhetter.co.uk> added the comment:

If we were to add a new attribute to indicate whether a file is real or not, 
there would need to be a way for users to indicate whether a file is real or 
not to functions such as `compile()` (there's lots more!) that take a filename. 
Without enforcing this being set and introducing backward incompatible changes, 
it would need a default value. To be backwards compatible we could default to 
True and the existing behaviour persists.

It's also worth mentioning that there's a few places (there might be more!) 
where Python already assumes that a file in angle brackets is not a real file:
* 
https://github.com/python/cpython/blob/abd7cd856ba326bd7574135c7d034e98492ab695/Lib/bdb.py#L45
* 
https://github.com/python/cpython/blob/abd7cd856ba326bd7574135c7d034e98492ab695/Lib/pdb.py#L694
* 
https://github.com/python/cpython/blob/abd7cd856ba326bd7574135c7d034e98492ab695/Lib/pickle.py#L324

Nothing major though and easily changeable so it's definitely possible but it 
would be a lot of work to make sure that everything is setting the new 
attribute properly.

Is there a preference on what the name of this attribute should be? Maybe 
`__is_real_file__`. It's clear but long.

----------
nosy: +AWhetter

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue16974>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to