[Tutor] How to use setUpmodule() variables in tests?

2016-05-07 Thread ramakrishna reddy
Dear All, In unittesting in python, how can I use variables of setUpModule() in tests? example: import unittest def setUpModule(): b = 20 #> how can I use this variable in testa print class A(unittest.TestCase): def testa(self): a = 10 print(a + b) if __name__ ==

[Tutor] Convert tuple within tuple into single tuple

2017-01-11 Thread ramakrishna reddy
Hi All, Is there any way to convert x = (1, 2, 3, (4, 5)) to x = (1, 2, 3, 4, 5) in python 2.7 Thanks in advance Ram. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] collections.Callable functionality

2017-03-05 Thread ramakrishna reddy
Hi, Can you please explain the functionality of collections.Callable ? If possible with a code snippet. I could not find a good explanation on google. Thanks, Ram. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

[Tutor] How sum() works in python

2017-08-01 Thread ramakrishna reddy
Hi All, I know > sum([1,2,3]) returns 6. But sum with [] 'empty list' as second parameter returns as below. > sum([[1,2,3], [3,4,5]], []) returns [1, 2, 3, 3, 4, 5] Can any one please explain this logic ? I searched in google but could not find the suitable answer. Thanks in advance. Thanks,

Re: [Tutor] How sum() works in python

2017-08-01 Thread ramakrishna reddy
nice explanation .. thanks this cleared my doubt >>> k = [20] >>> for i in [[1,2,3],[3,4,5]]: ... k += i ... >>> k [20, 1, 2, 3, 3, 4, 5] On Tue, Aug 1, 2017 at 1:35 AM, Alan Gauld via Tutor wrote: > On 01/08/17 07:06, ramakrishna reddy wrote: > > >&g

[Tutor] Variable name containing '-'

2017-09-01 Thread ramakrishna reddy
Hi there, I am implementing a soap webservice where a method which has keyword parameter(named:abc-xyz) needs to be used to call third party app. eg: obj.method(abc-xyz=10) As python does not support '-' in variable names, I am a bit confused. I know in case of methods we can use getattr(self.ob