On 02/10/15 17:52, Anshu Kumar wrote:
When we invoke the same function inside a function (recursive function), i want to keep track of some data across all function invocation so i should have shareable type but built in data types string, int are not helping as they are immutable they are changed while next invocation.
Show us some code and we will understand exactly what you are struggling with. I think I know, but it would be easier if
you give a specific short example.
I could use lists which are mutable but sometimes i find it not suitable for example when i need only single number or string.
You can create a closure using a list, or you could use a global or you could just use a lot of parameters/return values. But without seeing exactly what you are trying to do its difficult to know which options suit you best. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor