I am debugging a set of code which is something like this:
http://dpaste.com/1JXTCF0
I am not able to understand that what role internet object is playing and how I
can use/call it.
As debugging the code I got at line 10. I am sending a request to particular
API and returning a request_obje
On 03/24/2018 07:14 PM, D'Arcy Cain wrote:
class C1(dict):
class C2(object):
def f(self):
return X['field']
O1 = C1()
O1['field'] = 1
O2 = O1.C2()
print(O2.f())
I prefer to *feed* the child to the parent or vice versa. Simplifies
things like testing.
Something like this:
<--
There was a typo in my original reply:
<>
class C1(object):
def __init__(self):
self.child = None
def foo(self):
print("I am {self.__class__.__name__} foo".format(self=self))
def adopt(self, child=N
On Sun, Mar 25, 2018 at 8:37 PM, Jugurtha Hadjar
wrote:
> On 03/24/2018 07:14 PM, D'Arcy Cain wrote:
>>
>> class C1(dict):
>>class C2(object):
>> def f(self):
>>return X['field']
>>
>> O1 = C1()
>> O1['field'] = 1
>> O2 = O1.C2()
>> print(O2.f())
>
>
> I prefer to *feed* the child
On 03/25/2018 04:37 AM, Jugurtha Hadjar wrote:
> On 03/24/2018 07:14 PM, D'Arcy Cain wrote:
>> class C1(dict):
>> class C2(object):
>> def f(self):
>> return X['field']
>>
>> O1 = C1()
>> O1['field'] = 1
>> O2 = O1.C2()
>> print(O2.f())
>
> I prefer to *feed* the child to the parent
On 03/25/2018 05:10 AM, Jugurtha Hadjar wrote:
> print("I am {self.__class__.__name__} foo".format(self=self))
Unrelated to the original issue but why not one of the following?
print("I am {0.__class__.__name__} foo".format(self))
print(f"I am {self.__class__.__name__} foo")
--
D'Arcy J
On 03/24/2018 06:54 PM, Steven D'Aprano wrote:
>> On Saturday, March 24, 2018 at 1:20:24 PM UTC-5, D'Arcy Cain wrote:
>>> I tried various forms of super() but that didn't seem to work.
>
> Define "doesn't see to work".
It accesses the parent class. I want to access the parent object.
--
D'Arcy
On 03/25/2018 11:17 AM, Chris Angelico wrote:
On Sun, Mar 25, 2018 at 8:37 PM, Jugurtha Hadjar
wrote:
On 03/24/2018 07:14 PM, D'Arcy Cain wrote:
class C1(dict):
class C2(object):
def f(self):
return X['field']
O1 = C1()
O1['field'] = 1
O2 = O1.C2()
print(O2.f())
I prefer
On Sun, 25 Mar 2018 21:17:59 +1100, Chris Angelico wrote:
> On Sun, Mar 25, 2018 at 8:37 PM, Jugurtha Hadjar
> wrote:
[...]
>> I prefer to *feed* the child to the parent or vice versa.
>
> Congrats, this ranks on my list of "creative people who sound like
> psycho murderers". Digital artists and
Erratum: "I can select C2, or C3 and I'll have the instance created with
my choice"
--
~ Jugurtha Hadjar,
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, March 24, 2018 at 11:31:38 PM UTC-5, Steven D'Aprano wrote:
> On Sat, 24 Mar 2018 20:08:47 -0700, Rick Johnson wrote:
[...]
> >
> > the inconsistency of using super _outside_ of Tkinter code
> > whilst simultaneously using explicit inheritance _inside_
> > Tkinter code was quite frankl
On Sun, 25 Mar 2018 06:11:53 -0500, D'Arcy Cain wrote:
> On 03/24/2018 06:54 PM, Steven D'Aprano wrote:
>>> On Saturday, March 24, 2018 at 1:20:24 PM UTC-5, D'Arcy Cain wrote:
I tried various forms of super() but that didn't seem to work.
>>
>> Define "doesn't see to work".
>
> It accesses
On Sun, 25 Mar 2018 05:57:40 -0500, D'Arcy Cain wrote:
> That was my original solution but it seems clumsy.
>
> O2 = O1.C2(O1)
Are you intentionally trying to melt my brain with horribly obfuscated,
meaningless names? If so, you've succeeded admirably millennium hand and
shrimp buggarit.
:-)
On 25/03/2018 02:47, Steven D'Aprano wrote:
On Sun, 25 Mar 2018 00:05:56 +0100, Peter J. Holzer wrote:
[...]
yes, good idea
Not if you want to avoid that string to int conversion (as you stated).
That is still there, but in addition you now split the string into a
list and then join the list
Am 25.03.18 um 14:32 schrieb bartc:
Using CPython on my machine, doing a string to int conversion that
specific number took 200 times as long as doing a normal assignment.
That conversion took 4 microseconds.
Not significant if it's only done once. But it might be executed a
million times.
On Sun, Mar 25, 2018 at 5:46 AM, Steven D'Aprano
wrote:
> On Sun, 25 Mar 2018 06:11:53 -0500, D'Arcy Cain wrote:
>> It accesses the parent class. I want to access the parent object.
>
> Ah. Well, no wonder it doesn't work: you're confusing the OO inheritance
> concept of "parent" (a superclass) w
On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote:
>> - with no arguments, using the parenthesis-free syntax,
>> Ruby automagically forwards the same arguments to the (single)
>> parent;
>
> Which is merely a natural result of Ruby's function/method call syntax.
> Not allowing a parenthe
On 3/25/2018 7:42 AM, Jugurtha Hadjar wrote:
class C2(object):
def __init__(self, parent=None):
self.parent = parent
Since parent is required, it should not be optional.
def foo(self):
print("I am {self.__class__.__name__} foo".format(self=self))
self.par
On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote:
[...]
> Ruby is fundamentally _opposed_ to the idea of multiple inheritance --
> as MI is rife with issues (technical, practical, and intuitive in
> nature) and thus, not a wise solution -- but you would have known that
> Steven
I know that
On Sun, 25 Mar 2018 08:09:02 -0600, Ian Kelly wrote:
> On Sun, Mar 25, 2018 at 5:46 AM, Steven D'Aprano
> wrote:
>> On Sun, 25 Mar 2018 06:11:53 -0500, D'Arcy Cain wrote:
>>> It accesses the parent class. I want to access the parent object.
>>
>> Ah. Well, no wonder it doesn't work: you're confu
On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote:
> On Saturday, March 24, 2018 at 11:31:38 PM UTC-5, Steven D'Aprano wrote:
[...]
>> "A foolish consistency is the hobgoblin of little minds, adored by
>> little statesmen and philosophers and divines."
>> >
>> > Thus, i chose to abandon super
ast writes:
> Hi
>
> I found this way to put a large number in
> a variable.
>
> C = int(
> "28871482380507712126714295971303939919776094592797"
> "22700926516024197432303799152733116328983144639225"
> "94197780311092934965557841894944174093380561511397"
> "42154241693397290542371100275104208
On 03/25/2018 03:25 PM, Terry Reedy wrote:
On 3/25/2018 7:42 AM, Jugurtha Hadjar wrote:
class C2(object):
def __init__(self, parent=None):
self.parent = parent
Since parent is required, it should not be optional.
You can still call it the way you'd call it if it were a posit
On 03/25/2018 11:57 AM, D'Arcy Cain wrote:
Something like this:
class C1(object):
...
class C2(object):
def __init__(self, parent=None):
self.parent = parent
Perhaps your email client is collapsing leading spaces but that isn't
what I wrote. The C2 class is supposed to be a m
On 25/03/2018 15:01, Christian Gollwitzer wrote:
Am 25.03.18 um 14:32 schrieb bartc:
Using CPython on my machine, doing a string to int conversion that
specific number took 200 times as long as doing a normal assignment.
That conversion took 4 microseconds.
Not significant if it's only done o
On 3/25/2018 10:53 AM, Joe Pfeiffer wrote:
After following the thread for a while... you will, of course, simply
have to do a string to int conversion no matter what approach you take
to writing it. The number is a string of digits; it has to be converted
to the internal representation. Even i
On 25/03/2018 15:53, Joe Pfeiffer wrote:
ast writes:
C = int(
"28871482380507712126714295971303939919776094592797"
"22700926516024197432303799152733116328983144639225"
"94197780311092934965557841894944174093380561511397"
"4215424169339729054237110027510420801349667317"
"551528592269629167
On Sun, Mar 25, 2018 at 9:01 AM, Jugurtha Hadjar
wrote:
>
> On 03/25/2018 03:25 PM, Terry Reedy wrote:
>>
>> On 3/25/2018 7:42 AM, Jugurtha Hadjar wrote:
>>
>>> class C2(object):
>>> def __init__(self, parent=None):
>>> self.parent = parent
>>
>>
>> Since parent is required, it shoul
Hello everyone,
This is my first email to the python list, I'll try my best to do it well.
TL;DR
I have recently read the documentation about how imports work on python,
and I was wondering why, when you execute a python file, the current
directory is not added by default to the PYTHONPATH ?
Ex
On Sun, Mar 25, 2018 at 9:01 AM, Jugurtha Hadjar
wrote:
>
> On 03/25/2018 03:25 PM, Terry Reedy wrote:
>> None.foo will raise AttributeError.
>>
>
> Right.. As I said, I tried to assume as little as possible about OP's code
> and namespace. Didn't want to include C1 in __init__ signature because I
On 3/25/2018 11:01 AM, Jugurtha Hadjar wrote:
On 03/25/2018 03:25 PM, Terry Reedy wrote:
On 3/25/2018 7:42 AM, Jugurtha Hadjar wrote:
class C2(object):
def __init__(self, parent=None):
self.parent = parent
Since parent is required, it should not be optional.
You can still c
On 2018-03-25, bartc wrote:
> On 25/03/2018 02:47, Steven D'Aprano wrote:
>
>> The Original Poster (OP) is concerned about saving, what, a tenth of a
>> microsecond in total? Hardly seems worth the effort, especially if you're
>> going to end up with something even slower.
>
> Using CPython on my
bartc writes:
> On 25/03/2018 15:53, Joe Pfeiffer wrote:
>> ast writes:
>
>>> C = int(
>>> "28871482380507712126714295971303939919776094592797"
>>> "22700926516024197432303799152733116328983144639225"
>>> "94197780311092934965557841894944174093380561511397"
>>> "42154241693397290542371100275
I have a VM in the cloud running centos that comes with python 2.7
installed on it. For my purpose, I need python 3.5 (or 6?)
However there is an issue with urlgrabber, and I believe this is due to
inconsistencies with the 2 python versions, whcih I am not able to resolve.
DETAILS
INSTALL PYTHO
On 25/03/2018 16:47, Grant Edwards wrote:
On 2018-03-25, bartc wrote:
On 25/03/2018 02:47, Steven D'Aprano wrote:
The Original Poster (OP) is concerned about saving, what, a tenth of a
microsecond in total? Hardly seems worth the effort, especially if you're
going to end up with something eve
On 03/25/2018 04:31 PM, Ian Kelly wrote:
On Sun, Mar 25, 2018 at 9:01 AM, Jugurtha Hadjar
wrote:
On 03/25/2018 03:25 PM, Terry Reedy wrote:
None.foo will raise AttributeError.
Right.. As I said, I tried to assume as little as possible about OP's code
and namespace. Didn't want to include C
On 03/25/2018 12:07 PM, D'Arcy Cain wrote:
On 03/25/2018 05:10 AM, Jugurtha Hadjar wrote:
print("I am {self.__class__.__name__} foo".format(self=self))
Unrelated to the original issue but why not one of the following?
print("I am {0.__class__.__name__} foo".format(self))
I prefer k
On Sunday, March 25, 2018 at 9:11:35 AM UTC-5, Steven D'Aprano wrote:
> On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote:
[...]
> I never said anything about not allowing it. But since
> you've gone on the defence about parens-free function
> calls, how is this for "consistency" in Ruby?
>
>
Le 25/03/2018 à 03:47, Steven D'Aprano a écrit :
On Sun, 25 Mar 2018 00:05:56 +0100, Peter J. Holzer wrote:
The Original Poster (OP) is concerned about saving, what, a tenth of a
microsecond in total? Hardly seems worth the effort, especially if you're
going to end up with something even sl
On Sunday, March 25, 2018 at 10:02:20 AM UTC-5, Jugurtha Hadjar wrote:
[...]
> Furthermore, the only case I'd use a positional argument is
> if I were 100% certain the code will not change, which I'm
> not.
And short of you possessing a crystal ball in good working
order (mine's currently in the s
On 2018-03-25 19:18:23 +0200, ast wrote:
> Le 25/03/2018 à 03:47, Steven D'Aprano a écrit :
> > The Original Poster (OP) is concerned about saving, what, a tenth of a
> > microsecond in total? Hardly seems worth the effort, especially if you're
> > going to end up with something even slower.
> >
>
On 2018-03-25 14:49:44 +, Steven D'Aprano wrote:
> The moniker "Python X-thousand" (Python 3000, 4000, 5000...) is usually
> understood to mean a backwards-compatibility breaking version. Since
> Python 4 will *not* be such a version, what you are calling 4000 is
> better called "5000".
If
On Sunday, March 25, 2018 at 9:52:30 AM UTC-5, Steven D'Aprano wrote:
> On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote:
[...]
> But refusing to use super in modern, new-style classes that
> don't have anything to do with tkinter is precisely the
> sort of *foolish* consistency that Emerson
Pyton Friends,
Do you have any code that will play the notes "ABCDEFG" from my computer
keyboard when a key is pressed ? For example if I press the "a" key the note
"a" will sound out of my speaker.
Thanks,
BigB
--
https://mail.python.org/mailman/listinfo/python-list
On 2018-02-19 12:39:51 +0100, Adriaan Renting wrote:
> >>> On 17-2-2018 at 22:02, in message
> ,
> Chris Angelico wrote:
> > On Sun, Feb 18, 2018 at 5:05 AM, Steven D'Aprano
> > wrote:
> >> If you're talking about common desktop computers, I think you're
> >> forgetting how recent multicore mach
On Mon, Mar 26, 2018 at 7:30 AM, Rick Johnson
wrote:
>> Especially since by your own admission, you are *giving up
>> correctness* in order to buy "consistency":
>
> "sacrificing correctness" only in a purely ideological
> sense.
>
> Explicit inheritance (aka: hard-coding the superclass
> symbol)
On Sun, 25 Mar 2018 13:30:14 -0700, Rick Johnson wrote:
[...]
>> Especially since by your own admission, you are *giving up correctness*
>> in order to buy "consistency":
>
> "sacrificing correctness" only in a purely ideological sense.
>
> Explicit inheritance (aka: hard-coding the superclass s
Was "Accessing parent objects."
On 03/25/2018 12:26 PM, Jugurtha Hadjar wrote:
>> print("I am {0.__class__.__name__} foo".format(self))
>
> I prefer keyword arguments, but if I used it that way I'd do:
>
> print("I am {0} foo".format(self.__class__.__name__))
These are contrived examples. In r
On Sun, 25 Mar 2018 23:29:07 +0200, Peter J. Holzer wrote:
[...]
>> >> By the way, multiple CPU machines are different from CPUs with
>> >> multiple cores:
>> >>
>> >> http://smallbusiness.chron.com/multiple-cpu-vs-multicore-33195.html
>> >
>> > Yeah, it was always "multiple CPUs", not "multiple
On Sun, 25 Mar 2018 10:33:49 -0700, Rick Johnson wrote:
> On Sunday, March 25, 2018 at 9:11:35 AM UTC-5, Steven D'Aprano wrote:
>> On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote:
> [...]
>> I never said anything about not allowing it. But since you've gone on
>> the defence about parens-fr
On Sun, 25 Mar 2018 21:50:27 +0200, Peter J. Holzer wrote:
> On 2018-03-25 14:49:44 +, Steven D'Aprano wrote:
>> The moniker "Python X-thousand" (Python 3000, 4000, 5000...) is usually
>> understood to mean a backwards-compatibility breaking version. Since
>> Python 4 will *not* be such a vers
On Mon, Mar 26, 2018 at 9:52 AM, Steven D'Aprano
wrote:
> On Sun, 25 Mar 2018 23:29:07 +0200, Peter J. Holzer wrote:
>
> [...]
>>> >> By the way, multiple CPU machines are different from CPUs with
>>> >> multiple cores:
>>> >>
>>> >> http://smallbusiness.chron.com/multiple-cpu-vs-multicore-33195.h
On 3/25/18 8:32 AM, bartc wrote:
On 25/03/2018 02:47, Steven D'Aprano wrote:
On Sun, 25 Mar 2018 00:05:56 +0100, Peter J. Holzer wrote:
[...]
yes, good idea
Not if you want to avoid that string to int conversion (as you stated).
That is still there, but in addition you now split the string
On 26/03/2018 00:27, Richard Damon wrote:
On 3/25/18 8:32 AM, bartc wrote:
Using CPython on my machine, doing a string to int conversion that
specific number took 200 times as long as doing a normal assignment.
That conversion took 4 microseconds.
Not significant if it's only done once. But
On Sunday, March 25, 2018 at 5:57:28 PM UTC-5, Steven D'Aprano wrote:
> [supposed "fix" to the sample script snipped]
>
> You know Rick, every time I start to think that talking to
> you like an adult might result in a productive and
> intelligent conversation, you pull a stunt like this. Once
>
On 3/25/18 9:37 PM, bartc wrote:
On 26/03/2018 00:27, Richard Damon wrote:
On 3/25/18 8:32 AM, bartc wrote:
Using CPython on my machine, doing a string to int conversion that
specific number took 200 times as long as doing a normal assignment.
That conversion took 4 microseconds.
Not signi
I imagine pygame could do this, if you give it:
https://freesound.org/people/pinkyfinger/packs/4409/
On Sun, Mar 25, 2018 at 1:31 PM, Bernard via Python-list
wrote:
>
> Pyton Friends,
> Do you have any code that will play the notes "ABCDEFG" from my computer
> keyboard when a key is pressed ? Fo
On Monday, March 26, 2018 at 12:55:43 AM UTC+5:30, Peter J. Holzer wrote:
> On 2018-03-25 19:18:23 +0200, ast wrote:
> > Le 25/03/2018 à 03:47, Steven D'Aprano a écrit :
> > > The Original Poster (OP) is concerned about saving, what, a tenth of a
> > > microsecond in total? Hardly seems worth the e
Peter J. Holzer wrote:
(Historically, many unixes allowed all users to read the environment
variables of all processes. I don't know if this is still the case for
e.g. Solaris or AIX - or macOS)
A quick test suggests it's still true in MacOSX 10.6:
% ps aeuww
USER PID %CPU %MEM VSZ
Arshpreet Singh writes:
> ...
> As debugging the code I got at line 10. I am sending a request to particular
> API and returning a request_object . further deep down it generates the
> "response_object" as from my requirements that should be JSON object but I am
> only getting Python-Object in
On Monday, 26 March 2018 11:32:51 UTC+5:30, dieter wrote:
> Fürther inspection utilities: "dir", "vars" and the "inspect" module.
> Read the documentation to find out what they do.
Thanks, Dieter, That is really helpful!
--
https://mail.python.org/mailman/listinfo/python-list
adrien oyono writes:
> I have recently read the documentation about how imports work on python,
> and I was wondering why, when you execute a python file, the current
> directory is not added by default to the PYTHONPATH ?
Maybe, to avoid surprises?
You can invoke a script from different positio
62 matches
Mail list logo