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/2012-January/116029.html below:

[Python-Dev] Store timestamps as decimal.Decimal objects

[Python-Dev] Store timestamps as decimal.Decimal objects [Python-Dev] Store timestamps as decimal.Decimal objectsGeorg Brandl g.brandl at gmx.net
Tue Jan 31 07:22:08 CET 2012
Am 31.01.2012 00:50, schrieb Matt Joiner:
> Sounds good, but I also prefer Alexander's method. The type information is
> already encoded in the class object. This way you don't need to maintain a
> mapping of strings to classes, and other functions/third party can join in the
> fun without needing access to the latest canonical mapping. Lastly there will be
> no confusion or contention for duplicate keys.

Sorry, I don't think it makes any sense to pass around classes as flags.
Sure, if you do something directly with the class, it's fine, but in this case
that's impossible. So you will be testing

  if format is datetime.datetime:
    ...
  elif format is decimal.Decimal:
    ...
  else:
    ...

which has no advantage at all over

  if format == "datetime":
    ...
  elif format == "decimal":
    ...
  else:

Not to speak of formats like "timespec" that don't have a respective class.
And how do you propose to handle the extensibility you speak of to work?

Georg

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