29
620hun
3y

This was in production for 3 years

Comments
  • 0
    I'm usually for abstraction but this.
    This is not ok
  • 0
    Explicit is better than implicit?
  • 15
    @jespersh I think the idea was to return the size. Note that nothing is returned.
  • 1
    I get why the function is redundant, but if you're gonna write the types in the doc comment anyway you're basically doing the same thing a programmer using a strictly typed language would do except you're also doing the part the language would do for them.
  • 8
    If python was statically typed u would’ve noticed this. Just saying….
  • 0
    @darrenrahnemoon how exactly? The expected return type is None and None is returned.
  • 1
    @620hun u can add lint rules to force devs to explicitly mention return types
  • 8
    @620hun If this was a strictly typed language the author would've specified that the function returns a number. Failing that, the first person who uses the function would've noticed that it returns void.
  • 1
    Seems correct to me. Does what is expected from its name …

    if the function otherwise was called like “get and RETURN file size” and returns none, then it would be really wrong …
  • 1
    @gcavalcante8808 are you joking? Functions starting with "get" always indicate that something is returned. No need to add "getAndReturn" to it. It’s redundant and too long.
  • 1
    @Lensflare I’m joking yes haha

    Certainly this is not a semantic question hahahaha

    Being more serious now, a type check using mypy or a unit test could made the life smooth in this case.

    I prefer the unit tests solution, as the return could be of a expected type but is still incorrect (this is a simple case, but you got the ideia I hope).
  • 0
    Sometimes wonder are these screenshots even real?
Add Comment