-3

I was just wondering if this is an clean way of writing code - if you define the same name of a variable (and precisely for a dictionary) that you use as an input and an output of some function e.g.:

my_dic = {}
my_dic = someFunction(my_dic,otherVariables)
**doing other things with my_dic **

The function someFunction only is meant to update the dictionary my_dic, so preferably the output should be the input but updated. Is this a safe way of coding? or would that result in some possible bugs?

1 Answer 1

2

This should not result in any bugs in your program if you are just trying to update the dictionary using a function.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.