Skip to content

Infer state defaults from typing #10

Description

@JamesArruda

Typing ResourceState and setting the default are most commonly going to be duplicated. This is similar for State values and the valid_type argument.

This looks more complicated:

class CashRegister(UP.Actor):
    waiting_customers = UP.ResourceState[simpy.Store](default=simpy.Store)
   number_served = UP.State[int](default=0, valid_types=int)

than this:

class CashRegister(UP.Actor):
    waiting_customers = UP.ResourceState[simpy.Store]()
    number_served = UP.State[int](default=0)

Any changes made here would have to allow for union types that would still require a single default value.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfutureCheck back in the future

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions