Re: how to set timeout for os.popen

2018-04-16 Thread Jugurtha Hadjar
On 04/15/2018 12:01 PM, Ho Yeung Lee wrote: while 1: runner = os.popen("tracert -d www.hello.com") o=runner.read() print(o) runner.close() runner = os.popen("tracert -d www.hello.com") o=runner.read() print(o) runner.close() runner = os.popen("tracert -d www.hello.com") o=runner.read() print(o) r

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
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"

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
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

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
issue a deprecation warning, and then use the new API instead of having the code be rigid. -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
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 w

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
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

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
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()

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
foo()    # I am C2 foo     # I am C1 foo c1.adopt(c2)    # I am C1 and I adopted C2 <----> -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Accessing parent objects

2018-03-25 Thread Jugurtha Hadjar
  parent.adopt(self) c2 = C2() c2.adoptme()    # No parent yet c1 = C1() c2.adoptme(c1)  # I am C1 and I adopted C2 c2.foo()    # I am C2 foo     # I am C1 foo c1.adopt(c2)    # I am C1 and I adopted C2 <--------> -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there are good DRY fix for this painful design pattern?

2018-03-01 Thread Jugurtha Hadjar
sleepy=", sleepy, " and groggy=", groggy) <--> -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Jugurtha Hadjar
t;, groggy) >>> f = Foo(1, 19) >>> f.spam() I am spam. sleepy= 1 >>> f.spam(sleepy=8) I am spam. sleepy= 8 >>> f.ham(sleepy=8) I am ham. sleepy= 8  and groggy= 19 >>> f.ham(sleepy=17, groggy=888) I am ham. sleepy= 17  and groggy= 888 -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Where has the practice of sending screen shots as source code come from?

2018-01-30 Thread Jugurtha Hadjar
On 01/29/2018 03:48 PM, alister via Python-list wrote: On Mon, 29 Jan 2018 15:20:06 +0100, Jugurtha Hadjar wrote: On 01/28/2018 04:43 PM, Skip Montanaro wrote: I've never been a Windows user, but at my current job, Windows is core to just about everything, so I am forced to use it for

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Jugurtha Hadjar
The CTO then said "Sorry.. I meant Ubuntu." and seeing my pale face, he said in a reassuring tone "Don't be afraid, there are no Windows machines here." which brought me back to life. I hope to be as brave as you some day. -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Read satellite images

2018-01-24 Thread Jugurtha Hadjar
. Assuming you are using Python 2 (from your print):     import binascii     with open('merg_2018011100_4km-pixel', 'rb') as f:     data = f.read()     hex_data = binascii.hexlify(data)     first_byte = hex_data[0:2]     print first_byte -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Speeding up the implementation of Stochastic Gradient Ascent in Python

2018-01-20 Thread Jugurtha Hadjar
for bin in range(10):     for i in range(len(self.list_of_items)):     for k in range(self.K2):     for f in range(4096): -- ~ Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to ensure user calls methods in correct order?

2017-07-01 Thread Jugurtha Hadjar
o_a_list_you_were_returning return OutputB(_b_result) def c(list_from_b): _c_result = you_get_the_point return OutputC(_c_result) -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: beginners choice: wx or tk?

2015-07-11 Thread Jugurtha Hadjar
r to distribute Python code without an interpreter, and let people get their own interpreters. I just found this: https://us.pycon.org/2012/schedule/presentation/393/ It's a talk titled "Deep Freeze: building better stand-alone apps with Python". I'll watch it later. ChrisA -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: re.findall help

2015-02-04 Thread Jugurtha Hadjar
nores the 2.2.2.2 because it doesn't have "ip=" in front of it, and was just lucky to have an IP address structure. You can then split "ip=" out of each item to have the IP address. -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Antispam measures circumventing

2013-09-22 Thread Jugurtha Hadjar
; that shows how websites exchange your data between them and let me tell you: It's not reassuring. -- Joel Goldstick http://joelgoldstick.com -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: What minimum should a person know before saying "I know Python"

2013-09-20 Thread Jugurtha Hadjar
l take years and I don't think you'll ever hit 100%, not even after decades. Sorry :) -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Antispam measures circumventing

2013-09-20 Thread Jugurtha Hadjar
hn.dospames...@removemehotmail.com' > ''.join(filter(lambda x: x==x.lower(),email)) >'john@hotmail.com' Nice ! As well as Vlastimil's suggestions. The things I found on the net weren't that well written. There were *way* too many lines that made me think "No way. There's gotta be a better way". -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Antispam measures circumventing

2013-09-20 Thread Jugurtha Hadjar
address? Maybe a function with no inverse function ? Generating an image that can't be converted back to text, etc.. If this is off-topic, you can just answer the "what is a better way to do that" part. Thanks, -- ~Jugurtha Hadjar, -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I calculate a mean with python?

2013-09-16 Thread Jugurtha Hadjar
then, n also doesn't need to be in the loop and list.count(i) gives the occurrences of i in your list, which you don't need. list.count(15) gives 1. thesum/list.count(15) doesn't change. -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I calculate a mean with python?

2013-09-16 Thread Jugurtha Hadjar
, why ? -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help to sort out the below code...

2013-09-14 Thread Jugurtha Hadjar
multiply by coefficients, and these coefficients (the percentage the state charges) is less likely to change than the costs of ingredients or your margins (money moves faster than legislation). -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: ImportError: No module named Image

2013-09-12 Thread Jugurtha Hadjar
he script you used. I can Google the guy's name, but he might have written dozens of things, so .. which one). -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Help please, why doesn't it show the next input?

2013-09-11 Thread Jugurtha Hadjar
On 09/12/2013 02:08 AM, Jugurtha Hadjar wrote: Try this on your python prompt mystring = "ThIs Is ThE wAy SoMe StUpId PeOpLe WrItE i DoN't KnOw WhY!" mystring.lower() This should return: "You shouldn't treat people of stupid, but I feel your pain", or let&#x

Re: Help please, why doesn't it show the next input?

2013-09-11 Thread Jugurtha Hadjar
On 09/11/2013 08:33 PM, William Bryant wrote: @Jugurtha Hadjar What does user_input.lower() mean/do? Hello, As did other people point out, it returns the lower case of a string. It's not user_input.lower(), it's any_string.lower() For example: Try this on your python prompt

Re: Python in XKCD today

2013-09-11 Thread Jugurtha Hadjar
On 09/11/2013 02:09 PM, Roy Smith wrote: http://xkcd.com/1263/ Nice one! -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Telnet to remote system and format output via web page

2013-09-11 Thread Jugurtha Hadjar
issue ? How sensitive is the information you are querying ? Must it be Telnet ? -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Help please, why doesn't it show the next input?

2013-09-11 Thread Jugurtha Hadjar
s with that But some questions: 1 - Why does the user have to specify that, why doesn't the program itself tell if it is a string or a number ? You just give it the data and it's up to him to tell. 2 - What is it you are trying to accomplish: Maybe there are shortcuts or better ways to do things. -- ~Jugurtha Hadjar, -- https://mail.python.org/mailman/listinfo/python-list

Re: Intermediate Python user needed help

2012-08-06 Thread Jugurtha Hadjar
rom a book, and feeling that you're "intermediate", you started reading from chapter 28 in a 29 chapters book. -- ~Jugurtha Hadjar, -- http://mail.python.org/mailman/listinfo/python-list

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Jugurtha Hadjar
On 06/06/2012 07:45 PM, MRAB wrote: On 06/06/2012 18:23, Jugurtha Hadjar wrote: [snip] "range returns a « generator », convert it to list to see.." --> "converts" instead of "convert". No, "convert" is correct here; it's the imperativ

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Jugurtha Hadjar
;for" is a meaningful english word.. So specifying you are talking about the reserved word would be nice. "storage of data on disk, and read back" --> maybe something like "storing data on disk, and reading it back". "memorisation" --> "memorization" (most used spelling). "initialisation" --> "initialization" Thanks you, -- ~Jugurtha Hadjar, -- http://mail.python.org/mailman/listinfo/python-list

Re: fputs

2012-06-05 Thread Jugurtha Hadjar
utput = open(dest_file, 'w') output.write(data_to_write) You can execute it this way: python e.g: python script.py data.txt -- ~Jugurtha Hadjar, -- http://mail.python.org/mailman/listinfo/python-list

Re: Please verify!!

2012-02-24 Thread Jugurtha Hadjar
to stick with, by the way ? -- ~Jugurtha Hadjar, -- http://mail.python.org/mailman/listinfo/python-list

Re: Beware, my computer was infected.

2012-02-20 Thread Jugurtha Hadjar
On 16/02/2012 01:34, Jugurtha Hadjar wrote: Hello gentlemen, I'm writing these words to give you a heads up. My computer has recently been infected with "1.exe", and I am doing what I can to contain it. It spreads via mail and I fear it will send SPAM to lists I am subscrib

Beware, my computer was infected.

2012-02-16 Thread Jugurtha Hadjar
ress, thank you to report it to me. I will not send you an executable, so if you receive one from me, please do not open it and it would be nice to report it. I will send an e-mail to this list once I think it is no longer in the system. Thank you all. -- ~Jugurtha Hadjar, -- http://mail.pyt

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-25 Thread Jugurtha Hadjar
the first place. Brilliant list, by the way. Gentlemen, I wish you a good night. -- ~Jugurtha Hadjar, -- http://mail.python.org/mailman/listinfo/python-list