[Tutor] Question

2017-12-10 Thread Khabbab Zakaria
I am working on a program where I found the line: x,y,z = np.loadtext('abcabc.txt', unpack= True, skiprows =1) What does the x, y, z thing mean? What does the unpack= True mean? Thank you -- Khabbab Zakaria Dept of Power Engineering Jadavpur University Calcutta India

Re: [Tutor] file opened by open() are closed automaticaly

2017-01-14 Thread ZEMMOURA Khalil Zakaria
Thanks a lot. that helped me to understand that behaviour. Best regards. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] file opened by open() are closed automaticaly

2017-01-14 Thread ZEMMOURA Khalil Zakaria
Hi, I am playing with python3.6 and i noticed a change in the behaviour of the open() builtin function. The file opened using open() is closed automaticaly after iterationg over it in the python shell Here is the dummy code i am using: # Beggin testfile = open('test.txt') for line in

Re: [Tutor] global interpreter lock

2016-09-15 Thread khalil zakaria Zemmoura
Basically, what that said is the global interpreter lock is something that allows only one thread at a time to be executed when you launch a python program in opposition of executing multiple threads at the same time (parallelism). when you launch a python program it create a process in memory.

Re: [Tutor] python memory management

2016-09-03 Thread zakaria
Is there any practical usage of using reference cycling? On Sat, 2016-09-03 at 14:56 +0100, Alan Gauld via Tutor wrote: > On 03/09/16 04:25, monik...@netzero.net wrote: > > > > > Is this what you mean?  > > a = 5 > > b = a > > a = b > > No, you are confusing variable names with objects. >

Re: [Tutor] What's the correct way to define/access methods of a member variable in a class pointing to an object?

2016-09-03 Thread khalil zakaria Zemmoura
Hi, Composition is a technique that allows you to express the 'has a' relationship between your object. I'm not a specialist of the OOP but I can see some issues in the model that you expose in your mail. Encapsulation and abstraction are all about designing an API. It allows you to expose

Re: [Tutor] Inheritance vs Assignment

2016-09-01 Thread khalil zakaria Zemmoura
Let me clarify some ideas that I spoke about in my last email. I talked about extending exception and linearization from the perspective of inheriting from a class without adding behavior or some extra attributes, because the code you provided was doing that. Reading the Alan response made me

Re: [Tutor] Inheritance vs Assignment

2016-09-01 Thread khalil zakaria Zemmoura
Assignment and inheritance are not comparable at all In the inheritance you are extending the base class (a) and in "a=b()" you are instantiating it - you create an object according to the blueprint that you difining. To understand the difference. Inheritance: Say you defined a costume type (a

Re: [Tutor] Problem

2016-08-29 Thread zakaria
The " {} " is the place holder of the values of a, b and c argument passed to format. this example maybe can help to understand print('I like the python {}'.format('mailing-list')) will output >>>  I like the python mailing-list The format methode will substitute the {} with the argument it

Re: [Tutor] Problem

2016-08-29 Thread zakaria
if you print the values of a, b ,c that satisfy and don't satisfy the condiction cm == 50 at the same time, you can't know what works and what did not work. here is the code that i wrote and worked well for a in range(1, 11):         # i replaced 10 by 11 to include the 10      for b in range(1,

Re: [Tutor] Downloading Slack Files

2016-08-28 Thread khalil zakaria Zemmoura
Just replace r.iter_content(...) By response.iter_content(...) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Downloading Slack Files

2016-08-28 Thread khalil zakaria Zemmoura
I noticed that you didn't store what requests downloaded in a new file you created. The usual pattern to use is to download a file and writing it to the HD drive. You have to create a file with "With open(file_name.extention, "wb") as f: " and write to that file. Here is the code that I suggest

Re: [Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-12 Thread khalil zakaria Zemmoura
Steven D'Aprano wrote: > On Wed, May 11, 2016 at 02:00:47PM +0100, khalil zakaria Zemmoura wrote: >> Hi, >> >> Suppose we have a dict >> Dic = { True: 'yes', 1: 'No'} >> >> According to the Python 3 documentation, the keys must have a unique >>

[Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-11 Thread khalil zakaria Zemmoura
Hi, Suppose we have a dict Dic = { True: 'yes', 1: 'No'} According to the Python 3 documentation, the keys must have a unique value so True is converted to integer because of the type coercion (boolean are subtype of integer) so boolean are winded to integer to be compared. Am I missing

Re: [Tutor] Tutor Digest, Vol 146, Issue 9

2016-04-09 Thread khalil zakaria Zemmoura
Hi, there is one place i think you have to have a look at it and it's the python official site. One thing i love about python is the so well written documentation, i remember when i was learning ruby and had to go to the official doc! it was hard to understand for the beginner how i was. so, here

Re: [Tutor] Understanding error in recursive function

2016-04-09 Thread khalil zakaria Zemmoura
Hi, I think your function runs forever because the only thing it done is calling it self when entering the for loop when you call your function in the for loop it jump to the definition (def howMany(aDict)) then initialise count and bond the value 0 to it then enter a for loop then call the

Re: [Tutor] Python OOP question

2016-04-03 Thread khalil zakaria Zemmoura
Hi, Other_hand seems to be a tuple object which is immutable (unchangeable) so you can't alter it. By the way, what other_hand is supposed to be? A variable that you declared as tuple? An instance of a class? As other people said to you, we can only guess because we don't see where "other_hand"

[Tutor] Fwd: How python keeps track of data types

2016-03-29 Thread khalil zakaria Zemmoura
-- Forwarded message -- From: Abhishek Kumar Date: 2016-03-29 7:15 GMT+01:00 Subject: Re: [Tutor] How python keeps track of data types To: Tutor@python.org Thanks everyone for answers and links.I wasn't aware of fact that python names are just references