A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-September/149439.html below:

[Python-Dev] PEP 557: Data Classes

[Python-Dev] PEP 557: Data Classes [Python-Dev] PEP 557: Data ClassesEric V. Smith eric at trueblade.com
Sat Sep 9 21:00:53 EDT 2017
On 9/9/2017 11:41 AM, Gustavo Carneiro wrote:
> Hi, it is not clear whether anything is done to total_cost:
> 
>      def total_cost(self) -> float:
> 
> Does this become a property automatically, or is it still a method 
> call?  To that end, some examples of *using* a data class, not just 
> defining one, would be helpful.
> 
> If it remains a normal method, why put it in this example at all? Makes 

Nothing is done with total_cost, it's still a method. It's meant to show 
that you can use methods in a Data Class.  Maybe I should add a method 
that has a parameter, or at least explain why that method is present in 
the example.

I'm not sure how I'd write an example showing you can you do everything 
you can with an undecorated class. I think some text explanation would 
be better.

Eric.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4