[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry, but I think there is a near zero chance that the language will be 
revised as you suggest. 

Marking this as closed. If you want to have more discussion, please take it to 
the python-ideas maillist.

--
resolution:  -> rejected
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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread மனோஜ்குமார் பழனிச்சாமி

மனோஜ்குமார் பழனிச்சாமி  added the comment:

Changing '__dict__' to __vars__ will be much better.

Like len() calling __len__()

Can we change the title?

Why Github Issue Tracker is not issued?

--

___
Python tracker 

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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The vars() function already does this.

--
nosy: +rhettinger

___
Python tracker 

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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread மனோஜ்குமார் பழனிச்சாமி

மனோஜ்குமார் பழனிச்சாமி  added the comment:

Your point makes sense as it takes space to allocate for the new instance to 
just return another dict object. 
Then the attribute name at least should be meaningful.

Instead of __dict__ , __attr__ is more appropriate.

--

___
Python tracker 

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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread Irit Katriel


Irit Katriel  added the comment:

You ignored the other point I made: dict is not a function, it is a class. 
dict() calls the function dict.__init__() which should create a new instance of 
dict (not return some field of its parameter). 


You also didn't justify your suggestion in any way. Why should this change be 
made?

--

___
Python tracker 

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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread மனோஜ்குமார் பழனிச்சாமி

மனோஜ்குமார் பழனிச்சாமி  added the comment:

Will return only if it is not an iterator

--

___
Python tracker 

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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread Irit Katriel


New submission from Irit Katriel :

dict is not a function, it's a class and the purpose of a dict() call is to 
create a new instance of that class.

The change you are proposing is also breaking for iterators:

>>> class Pairs(list): pass
... 
>>> pairs = Pairs([('a', 1), ('b', 2)])
>>> pairs.__dict__
{}
>>> dict(pairs)
{'a': 1, 'b': 2}

A change of this magnitude will need to be discussed on python-ideas and will 
require a PEP explaining why the benefits of the change outweigh its costs. I 
very much doubt that they do.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread மனோஜ்குமார் பழனிச்சாமி

Change by மனோஜ்குமார் பழனிச்சாமி :


--
nosy: SmartManoj
priority: normal
severity: normal
status: open
title: Make dict(object) return its attribute __dict__
type: enhancement
versions: Python 3.10

___
Python tracker 

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