nikaro

joined 1 year ago
[–] [email protected] 6 points 2 months ago

And no smartphone in your pocket, of course.

[–] [email protected] 18 points 2 months ago

You can use KeePassXC (with a dedicated vault or not), synced by another mean (Nextcloud, Syncthing, Git, etc.).

[–] [email protected] 4 points 1 year ago

Nice! It looks like the best solution out there.

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

Python >= 3.10 version:

def foo(return_more: bool) -> DataType | tuple[DataType, MoreDataType]: ...

But i would definitely avoid to do that if possible. I would maybe do something like this instead:

def foo(return_more: bool) -> tuple[DataType, MoreDataType | None]:
    ...
    if return_more:
        return data, more_data
   return data, None

Or if data is a dict, just update it with more_data:

def foo(return_more: bool) -> dict[str, Any]:
    ...
    if return_more:
        return data.update(more_data)
   return data
[–] [email protected] 1 points 1 year ago

The difference is that with Protocol you can define which method presence you want to ensure. Like i said: custom vs. generic.

[–] [email protected] 1 points 1 year ago (2 children)

From what i understand, Protocol is for custom interfaces that you define (this object must have do_x() method), while ABCs are generic (this object is iterable).

 

This is like Interface in Go (or Java, i don't speak Java but the article say so).

 

TLDR: terraform bad, pulumi good