Skip to content

Instantly share code, notes, and snippets.

View amano-takahisa's full-sized avatar
🛰️

Taka amano-takahisa

🛰️
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

How to keep repositories small

Avoid committing unnecessary files by mistake

Once inappropreate files have been committed and pushed to Git server, it is difficult to remove them completely from git. Therefore, it is important to setup first a development environment that does not accidentally commit such files.

Inappropreate files are including following files.

  • Crazy big files
@amano-takahisa
amano-takahisa / keep_the_output_type_as_constant.md
Created February 8, 2022 10:51
Keep the output type as constant as possible

Keep the output type as constant as possible

I would like to explain why it is better to keep the output type as constant as possible regardless of value of inputs by implementing a similar function in two different ways.

A function always returns the same type

If we need a function which returns a list of multiples of three from given list of integer, a function is simply like this:

def extract_multiples_of_three(values: List[int]) -> List[int]:
    return [v for v in values if v % 3 == 0]