Why you should make sure that your function params are extensible ? (ashu1461.com) 1 points by ashu1461 2y ago ↗ HN
[–] necovek 2y ago ↗ In general, passing objects around is a seeming workaround for "passing too many arguments in", but really, you still are (passing many arguments in).Which means that your code sucks and is badly structured.As for readability argument, I can't not ask why are not all languages using Python's approach by now?If you dislike everything else about Python, I am sure you can't dislike the fact you can do create_user(id=generate_uuid(), name='Lucky Luke') instead of or in addition to create_user(generate_uuid(), 'Lucky Luke') [–] ashu1461 2y ago ↗ Well I get your perspective, but I don't think it is universally true track_activity(customerId: string, eventId: string, pageId: string, pageName: string, sessionDuration: number) This can always be refactored into track_activity(event: Event) [–] necovek 2y ago ↗ And then Event grows some other properties for non-tracking purposes which are not used in this function and you realize you now need to construct values you don't need to be able to call this function ;)
[–] ashu1461 2y ago ↗ Well I get your perspective, but I don't think it is universally true track_activity(customerId: string, eventId: string, pageId: string, pageName: string, sessionDuration: number) This can always be refactored into track_activity(event: Event) [–] necovek 2y ago ↗ And then Event grows some other properties for non-tracking purposes which are not used in this function and you realize you now need to construct values you don't need to be able to call this function ;)
[–] necovek 2y ago ↗ And then Event grows some other properties for non-tracking purposes which are not used in this function and you realize you now need to construct values you don't need to be able to call this function ;)
4 comments
[ 3.5 ms ] story [ 18.1 ms ] threadWhich means that your code sucks and is badly structured.
As for readability argument, I can't not ask why are not all languages using Python's approach by now?
If you dislike everything else about Python, I am sure you can't dislike the fact you can do
instead of or in addition to