Skip to content

Instantly share code, notes, and snippets.

@nda86
Created December 22, 2021 17:37
Show Gist options
  • Save nda86/1e9f55113fda02c0785fffef2e81e3ba to your computer and use it in GitHub Desktop.
Save nda86/1e9f55113fda02c0785fffef2e81e3ba to your computer and use it in GitHub Desktop.
from dataclasses import dataclass, field
@dataclass
class VehicleSpecificationsForm:
vehicle_body_length: int
vehicle_body_height: int
vehicle_body_width: int
vehicle_volume_capacity: float = field(init=False)
def __post_init__(self):
self.vehicle_volume_capacity = (
self.vehicle_body_length * self.vehicle_body_width * self.vehicle_body_height
) / 1000000 # см3 в м3
vsf = VehicleSpecificationsForm(vehicle_body_width=195, vehicle_body_height=200, vehicle_body_length=350)
print(vsf.vehicle_volume_capacity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment