New submission from Landon Ginn <landonjpg...@gmail.com>:

from dataclasses import dataclass, field

@dataclass(order=True, frozen=True)
class Character:
    sort_index: int = field(init=False, repr=False)
    name: str
    job: str
    age: int
    intelligence: int = 50

    def __post_init__(self):
        object.__setattr__(self, 'sortindex', self.intelligence)

Description:
using sortindex instead of sort_index gave the following suggestion: 

Current:
AttributeError: 'Character' object has no attribute 'sort_index'. Did you mean: 
'sortindex'?


Expected: 
AttributeError: 'Character' object has no attribute 'sortindex'. Did you mean: 
'sort_index'?

----------
components: Library (Lib)
messages: 408919
nosy: landonjpginn
priority: normal
severity: normal
status: open
title: Dataclass Suggestion reversed: sortindex / sort_index
type: behavior
versions: Python 3.10

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

Reply via email to