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. bec

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 simpl

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 rea

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 cla

Re: [Tutor] Problem

2016-08-29 Thread khalil zakaria Zemmoura
Can you please rewrite the python code using proper indentation, since, as you know, indentation matters in Python Le 28 août 2016 18:40, "shahan khan" a écrit : Hello I'm teching myself Python using MIT opencourse ware. I'm a beginner and have some what knowledge of c and c++. I'm using Python

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 Wi

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

[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 somethin

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 funct

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 to Objects. Abhishek O