[issue18535] termios.tcgetattr should return namedtuple

2022-03-25 Thread Irit Katriel


Irit Katriel  added the comment:

The patch has no tests, the use case is not clear and it's been 9 years. 
Closing.

--
nosy: +iritkatriel
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-24 Thread anatoly techtonik

anatoly techtonik added the comment:

I've made my own monster, attached.

--
Added file: http://bugs.python.org/file31026/DictRecord.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

You need a better use case though.
termios awful constant names ('TIOCGWINSZ') and values ('\x1b') won't become 
more easy with a nametuple.

--
resolution:  - works for me
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-24 Thread anatoly techtonik

anatoly techtonik added the comment:

Do not hijack the issue - value interpretation is the next step, which better 
keep out of scope for this improvement. termios is a C interface, which 
documents the meaning of TIOCGWINSZ and has defined names for structure 
entries, such as lflag. This issue is to make Python code at least as readable 
as C.

C doesn't allow you to revert value meaning from ('\x1b') to text form.

--
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-24 Thread anatoly techtonik

anatoly techtonik added the comment:

If you need a better use case for DictRecord, urlparse is another one.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-24 Thread R. David Murray

R. David Murray added the comment:

Anatoly: FYI Do not hijack the issue is not a collaborative conversation 
style in English.  A more collaborative conversation style would be to leave 
out that part of the sentence, and just say that you think value interpretation 
should be a separate, later issue (with your reasons, of course).

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-23 Thread anatoly techtonik

New submission from anatoly techtonik:

Names of field for tuple returned by tcgetattr are already in documentation at 
http://docs.python.org/2/library/termios.html

It would be nice to get them into code.

--
components: Library (Lib)
messages: 193595
nosy: techtonik
priority: normal
severity: normal
status: open
title: termios.tcgetattr should return namedtuple
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-23 Thread anatoly techtonik

anatoly techtonik added the comment:

Actually namedtuple doesn't suit the use case well. The use case is to read 
termios config, (re)set flags set it back. The attributes should be mutable.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

namedtuple has a _replace method, but I agree that it would be an incompatible 
change. namedlist someone?

class tcattributes(object):
__slots__ = ['iflag', 'oflag', 'cflag', 'lflag', 'ispeed', 'ospeed', 'cc']

def __new__(cls, values):
self = object.__new__(cls)
for attr, value in zip(cls.__slots__, values):
setattr(self, attr, value)
return self

def __getitem__(self, index):
return getattr(self, self.__slots__[index])

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18535] termios.tcgetattr should return namedtuple

2013-07-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Returning a list was probably silly to begin with (a dict would have been more 
natural).
However, I don't think I want to see such a thing as a namedlist in the stdlib. 
:-(

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18535
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com