n object at 0x10e078128>
>>> p = Person(11)
>>> p.dob
11
Although I marked dob as date type, why am I able to assign it an int? So my
question how does type annotation helps, when should we use them and what
advantages it brings?
Thanks,
Arup Rakshit
a...@zeit.io
___
> On 19-May-2019, at 4:46 AM, Mark Lawrence wrote:
>
> On 18/05/2019 17:21, Arup Rakshit wrote:
>> I am writing an Flask app following a book, where a piece of python concept
>> I am not getting how it works. Code is:
>> class Role(db.Model):
>>
self.permissions = 0
Here, why super(Role, self).__init__(**kwargs) is used instead of
super().__init__(**kwargs) ? What that Role and self argument is instructing
the super() ?
Thanks,
Arup Rakshit
a...@zeit.io
___
Tutor maillist - T
how these search happens in 2 contexts.
Thanks,
Arup Rakshit
a...@zeit.io
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 30/04/19 5:11 AM, Steven D'Aprano wrote:
On Tue, Apr 30, 2019 at 12:47:02AM +0530, Arup Rakshit wrote:
I really didn't write that code by myself. The day I'll you will not see
me here everyday :) . I was watching a PyCon video
https://youtu.be/81S01c9zytE?t=8172 where the a
re I think I hit the wall everytime.
Python doesn't work the way I am thinking it, and I am far behind of this.
--
Thanks,
Arup Rakshit
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 29/04/19 11:40 PM, Steven D'Aprano wrote:
On Mon, Apr 29, 2019 at 11:25:51PM +0530, Arup Rakshit wrote:
Now I am not getting how the __set__() method from NonBlank is being
called inside the __init__() method. Looks like some magic is going on
under the hood. Can anyone please explain
ooks like some magic is going on under the hood.
Can anyone please explain this how self.name and self.email assignment is
called the __set__ from NonBlank? What is the name of this concept?
Thanks,
Arup Rakshit
a...@zeit.io
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
case. So if
anyone can explain this, I will be very helpful.
Thanks,
Arup Rakshit
a...@zeit.io
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 26/04/19 10:58 AM, Steven D'Aprano wrote:
On Thu, Apr 25, 2019 at 05:40:18PM +0530, Arup Rakshit wrote:
I have a small app like this:
Please simplify your code to the minimum needed to demonstrate the
problem you are asking about. This bit is excellent:
pizza-shop$ tree .
.
└── pi
On 26/04/19 8:58 PM, Alan Gauld via Tutor wrote:
On 26/04/2019 13:48, Arup Rakshit wrote:
BTW, one thing I would like to know about this list is that, everytime I
send an email I see it the in list after 2 hours approx. Is this for me
or everybody? I am just curious.
Just for you! ...And
On 26/04/19 11:10 AM, Steven D'Aprano wrote:
On Thu, Apr 25, 2019 at 02:52:07PM +0530, Arup Rakshit wrote:
Here it is: *3.3.2.1. Customizing module attribute access*
(https://docs.python.org/3/reference/datamodel.html#customizing-module-attribute-access)
Oh! That's brand new in 3.7,
izzapy import menu
Traceback (most recent call last):
File "", line 1, in
File "/Users/aruprakshit/python_playground/pizza-shop/pizzapy/menu.py", line
2, in
from pizza import Pizza
ModuleNotFoundError: No module named 'pizza'
>>>
What is the reaso
On 25/04/19 1:21 PM, Steven D'Aprano wrote:
On Thu, Apr 25, 2019 at 11:30:28AM +0530, Arup Rakshit wrote:
On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote:
On 24/04/2019 12:22, Arup Rakshit wrote:
In the simple code like what are the advantages we get from?
I'm not really sure wh
On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote:
On 24/04/2019 12:22, Arup Rakshit wrote:
In the simple code like what are the advantages we get from?
I'm not really sure what you are asking about?
Ok. My question is that when people add such a class to the module? What
is the goal/inte
are other reasons of this setup?
import fine_grained_module
fine_grained_module.foo = "foo”
# Setting foo…
repr(fine_grained_module)
# 'Verbose fine_grained_module'
Thanks,
Arup Rakshit
a...@zeit.io
___
Tutor maillist - Tutor@
On 23/04/19 10:08 PM, Steven D'Aprano wrote:
On Tue, Apr 23, 2019 at 08:27:15PM +0530, Arup Rakshit wrote:
You probably want:
def __init__(self, list=None):
if list is None:
list = []
self.list = list
That is really a new thing to me. I didn
ate this to educate me please?
doc said:
> This method should either return the (computed) attribute value or
raise an AttributeError exception.
Another question:
My question is that: Can I raise a domain error like
OperationNotPermitted when raising i
ent than in the body of __init__ method? Can you
elaborate this?
--
Thanks,
Arup Rakshit
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
CustomList(list=[1, 2, 3, 4, 5, 6])
print(list[1:3])
print(list[3])
print("===\n")
list = MyCustomListV1(list=[1, 2, 3, 4, 5, 6])
print(list[1:3])
print(list[3])
If run it, I get the output:
[2, 3]
4
===
[2, 3]
4
--
T
On 22/04/19 3:35 PM, Alan Gauld via Tutor wrote:
On 22/04/2019 10:18, Arup Rakshit wrote:
Consider the below in simple class:
class RandomKlass:
def __init__(self, x):
self.x = x
def __del__(self):
print("Deleted…")
Now when I delete the object cr
del__ says:
> `del x` doesn’t directly call `x.__del__()` — the former decrements the
> reference count for `x` by one, and the latter is only called when `x`’s
> reference count reaches zero.
Also what the reference count here means? I know that x can hold only one
reference at a t
Suppose, if I have the string 'aababbb', I want to get the output as 'aababb'.
I want the output in time complexity O(N) and space complexity O(1). when input
string is 'abababa', output should be same as input.
___
Tutor maillist - Tutor@python.org
T
23 matches
Mail list logo