Post image
Light Mode
Dark Mode
Python May Move To Calendar Versioning! But For Saving Files Use Number Versioning

Hello, checkiomates๐Ÿฑโ€๐Ÿ‘ค!

Read about possible upcoming changes in Python Calendar Versioning and try to find out a correct file name for saving.

๐Ÿ’กTIP

If you find an interesting solution, you may add it to your bookmarks by clicking the flag near solution title. You can find all your bookmarked solutions by clicking your nickame and then "Bookmarks". If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

๐ŸMISSION

Save File by freeman_lex -

You are given a sequence of names of existing files and a single filename that need to be saved into the sequence. If a file with the same name already exists in the sequence, a numerical suffix (n) should be added to the file name (the first integer n, with which a new filename is not present in the sequence). Note, that filename may already include one or more suffixes. The function should return the name with which the file will be saved into the sequence.

save_file((), "name.txt") == "name.txt"
save_file(("test.txt",), "name.txt") == "name.txt"
save_file(("name.txt",), "name.txt") == "name(1).txt"

๐Ÿ“–ARTICLE

The Python Language Summit 2024: Should Python adopt Calendar Versioning? -

Hugo van Kemenade, the newly announced Release Manager for Python 3.14 and 3.15, started the Language Summit with a proposal to change Python's versioning scheme. The goal of Hugo's proposal was to make expectations around versioning, backwards compatibility, and support timelines clearer for Python users. See the explanation in the following article.

๐Ÿ‘ฉโ€๐Ÿ’ปCODE SHOT

How do you think, what the following code does?

def ?????????(*args) -> int:
    
    for i in range(min(args), 0, -1):
        dl = lambda x: x // i == x / i
        if all(map(dl, args)):
            break
    return i

๐Ÿ™Œ Thanks for your attention! Hope to meet you at CheckiO, as well as at our Instagram and Twitter! We are really interested in your thoughts! Please, leave a comment below! โคต

Created: June 24, 2024, 4:30 p.m.
0
41
User avatar
freeman_lex