python | Unsorted

Telegram-канал python - Python

135201

You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython

Subscribe to a channel

Python

float(decimal.Decimal('.1') + decimal.Decimal('.2'))
and
float(fractions.Fraction('0.1') + fractions.Fraction('0.2'))

so will should i use the fraction?

Читать полностью…

Python

If you were to calculate floats for currency, prices, legal and tax documents
Then yes, you use Decimal
But as its software based and on base-10 rule, it makes it slower to work with then other solutions

But for high precision and high speed calculation needed for example in data science or calculating a rocket orbit
You need something with high precision, where the error at the 50th decimal place does not affect the outcome

So it comes down to what you are actually calculating

Читать полностью…

Python

No, that's not what we do here.

Читать полностью…

Python

/channel/Python/2266296

Читать полностью…

Python

What are you calculating?

Читать полностью…

Python

why library i listen we should to do

Decimal("0.1") + Decimal("0.2")

like this, eo why need library

Читать полностью…

Python

That was too easy, thx for the assist

Читать полностью…

Python

In a windows computer, as any other program, you download the installer, open it and follow the assistant

Читать полностью…

Python

Mildred Raines, please verify you are human by clicking the button below. You have 90 seconds.

Читать полностью…

Python

Jokes are better made at @pythonofftopic. It's better not to make jokes here. Be sure to delete this very funny joke.

Читать полностью…

Python

Don’t Assume Floating-Point Numbers Are Perfectly Accurate
https://inventwithpython.com/beyond/chapter8.html

Читать полностью…

Python

why python gives 0.30000000000000004 when adding 0.1 + 0.2

Читать полностью…

Python

You can, but that's bad practice and domain is about your business logic and that's, I think, strange to validate something here

And you need to map models to your ORM (or whatever you use) models probably, and dataclasses is better here

Pydantic here is like using ladle where you can use spoon

Читать полностью…

Python

so i though pydantic's BaseModel will replace the my core python things what do you say will thsi really bad to use Pydantic's models here for store data and pass to another places

Читать полностью…

Python

Anyone blogging websites expert here

Читать полностью…

Python

so n past u say :-> for all price, tax tables i should to always use the decimal.Decimal. from then i switched to this for all my code.
now what u say i will use in real production case. !

Читать полностью…

Python

i was calculating

Decimal("0.1")+Decimal("0.2")
decimal adding without causing any floating problem without using any external library!

Читать полностью…

Python

Can anyone help me with python's technology to build an ai driven app

Читать полностью…

Python

Yes, we have established that already.

Читать полностью…

Python

i means, as he says we will use library here for this!!!
but i found normally with the Decimal we can solve the float problem. so ehat rhe library be say to use

Читать полностью…

Python

That's the case with all programming languages
Floating numbers are handled with a binary representation, so there will be an overflow at times
There are libraries designed to handle that though

Читать полностью…

Python

thanks all of you guys

Читать полностью…

Python

How to install python

Читать полностью…

Python

Use Decimal() from decimal module.

Читать полностью…

Python

I didn't get it

Читать полностью…

Python

https://0.30000000000000004.com/

Читать полностью…

Python

But if you know problems that can cause this decision and if you can bear upon with it - you can use pydantic, that's legal for pragmatic architecture
I've used ORM in domain entities and that's ok if you know what you are doing (https://github.com/MagM1go/marionette/blob/main/src/marionette/domain/entities/character.py)

https://github.com/MagM1go/marionette/blob/main/README_en.md

Читать полностью…

Python

Please ask smart questions.

Читать полностью…

Python

No external dependencies in domain. Dataclass is better here

Читать полностью…

Python

This is not a group to discuss project ideas.

Читать полностью…
Subscribe to a channel