Help for a newbie regarding code & physical switches

2015-05-19 Thread Howard Spink
I have a Pi + SD card with Pi OS + PiTfT screen I am trying to display specific JPEGs when certain combination of GP10 inputs are HIGH. I would like to use Python, I have no background in programming. Can someone point me on the right tracks? -- https://mail.python.org/mailman/listinfo/python-

Re: Slices time complexity

2015-05-19 Thread Marko Rauhamaa
Rustom Mody : > In short any language that is implemented on von Neumann hw will need > to address memory. I don't think von Neumann hardware plays a role here. I think the data model is inherent in Python/Java/Lisp regardless of the underlying formalism (which could be SKI combinatory calculus o

Help a newbie with basic coding involving physical switches

2015-05-19 Thread Howard Spink
I have ordered a Pi + SD card + PiTfT screen. -- https://mail.python.org/mailman/listinfo/python-list

Re: Slices time complexity

2015-05-19 Thread Rustom Mody
On Wednesday, May 20, 2015 at 11:27:56 AM UTC+5:30, Steven D'Aprano wrote: > On Wednesday 20 May 2015 14:30, Rustom Mody wrote: > > > And what about Java? > > http://stackoverflow.com/questions/166033/value-semantics-and-pointer- > semantics > > Congratulations, you have found yet another example

Re: Slices time complexity

2015-05-19 Thread Marko Rauhamaa
Steven D'Aprano : > Rustom, if you are serious about this approach, then the implication > is that if I execute "x = 23" in Python, and I ask you what the value > of x is, you should answer something like "146588120" (that's the > implementation dependent "value", i.e. the address of the int 23).

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wednesday 20 May 2015 15:33, Steven D'Aprano wrote: > Someone sufficiently killed with an abacus Er, *skilled*. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wednesday 20 May 2015 14:30, Rustom Mody wrote: > And what about Java? > http://stackoverflow.com/questions/166033/value-semantics-and-pointer- semantics Congratulations, you have found yet another example of the Java community's collective delusion and insistence on misusing terms for the ma

Re: Sftp error New Help

2015-05-19 Thread dieter
ejmmann...@gmail.com writes: > Traceback (most recent call last): > File "Juniper.py", line 66, in > device_information() > File "Juniper.py", line 26, in device_information > device_connection(dev_ip,dev_username,dev_password) > File "Juniper.py", line 54, in device_connection >

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wednesday 20 May 2015 14:30, Marko Rauhamaa wrote: > Steven D'Aprano : > >> There is a little magic elf hiding inside the computer, and when you >> type an expression like '2 + 3', little tiny hammers bang it out in >> Morse Code on the elf's head; in response, the elf calculates the >> answer

Re: Slightly OT: Seeking (python-based) project diary tool, or framework to write one

2015-05-19 Thread Frank Millman
"jkn" wrote in message news:99067d97-cad4-42f8-8fd1-b1884bed7...@googlegroups.com... > Hi All >as in the title, this is a little bit OT - but since ideally I'd like a > tool written in Python, and I know readers here have wide experience of > development/collaborative workflows etc ... > Ha

Re: Writing a function to calculate scores

2015-05-19 Thread Rustom Mody
On Wednesday, May 20, 2015 at 9:21:51 AM UTC+5:30, Grace Anne St Clair-Bates wrote: > Hello! I am trying to write a funtion that calculates scores of three random > dots on a "bean-bag" board that land on different holes. Each hole holds a > certain amount of point. I need to take where the comp

Sftp error New Help

2015-05-19 Thread ejmmanning
Traceback (most recent call last): File "Juniper.py", line 66, in device_information() File "Juniper.py", line 26, in device_information device_connection(dev_ip,dev_username,dev_password) File "Juniper.py", line 54, in device_connection sftp_transfer(r) File "Juniper.py", line

Re: Slices time complexity

2015-05-19 Thread Mark Lawrence
On 20/05/2015 05:30, Rustom Mody wrote: On Wednesday, May 20, 2015 at 9:54:57 AM UTC+5:30, Marko Rauhamaa wrote: Ben Finney : Right. So the box with an arrow coming out of it is a good metaphor for pointers -- *in languages that have pointers*, which Python does not. A box with an arrow comin

Re: Slices time complexity

2015-05-19 Thread Marko Rauhamaa
Steven D'Aprano : > There is a little magic elf hiding inside the computer, and when you > type an expression like '2 + 3', little tiny hammers bang it out in > Morse Code on the elf's head; in response, the elf calculates the > answer on his teeny tiny abacus and passes it back to the interpreter

Re: Slices time complexity

2015-05-19 Thread Rustom Mody
On Wednesday, May 20, 2015 at 9:54:57 AM UTC+5:30, Marko Rauhamaa wrote: > Ben Finney : > > > Right. So the box with an arrow coming out of it is a good metaphor for > > pointers -- *in languages that have pointers*, which Python does not. > > > > A box with an arrow coming out of it is a poor met

Re: Slices time complexity

2015-05-19 Thread Marko Rauhamaa
Ben Finney : > Right. So the box with an arrow coming out of it is a good metaphor for > pointers — *in languages that have pointers*, which Python does not. > > A box with an arrow coming out of it is a poor metaphor for Python's > references, since a Python reference doesn't contain anything acc

Writing a function to calculate scores

2015-05-19 Thread Grace Anne St Clair-Bates
Hello! I am trying to write a funtion that calculates scores of three random dots on a "bean-bag" board that land on different holes. Each hole holds a certain amount of point. I need to take where the computer has randomly places three points in my turtle graphic and calculate the total score.

Re: Rule of order for dot operators?

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 12:24 PM, Thomas 'PointedEars' Lahn wrote: > And who appointed you moderator? I would not mind if you *asked* people > publicly for politeness as I do that myself sometimes, but I do mind the > overall tone of your off-topic comments, your apparently trying to dictate > wh

Re: Slices time complexity

2015-05-19 Thread Rustom Mody
On Wednesday, May 20, 2015 at 7:56:43 AM UTC+5:30, Steven D'Aprano wrote: > On Wed, 20 May 2015 10:31 am, Gregory Ewing wrote: > > > Steven D'Aprano wrote: > >> Chris, that is one of the best explanations for why "references equals > >> pointers" is *not* a good explanation for Python's behaviour.

Re: Rule of order for dot operators?

2015-05-19 Thread Ned Batchelder
On Tuesday, May 19, 2015 at 10:26:56 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > > And who appointed you moderator? I would not mind if you *asked* people > publicly for politeness as I do that myself sometimes, but I do mind the > overall tone of your off-topic comments, your apparently tryin

Re: Slices time complexity

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 12:26 PM, Steven D'Aprano wrote: > On Wed, 20 May 2015 10:31 am, Gregory Ewing wrote: > >> Steven D'Aprano wrote: >>> Chris, that is one of the best explanations for why "references equals >>> pointers" is *not* a good explanation for Python's behaviour. >> >> Many people h

Re: Rule of order for dot operators?

2015-05-19 Thread Steven D'Aprano
On Wed, 20 May 2015 11:36 am, Ned Batchelder wrote: > Steven and Denis: you were too blunt in your objections. Fair enough. In my defence, I'm from Australia, and we're notorious for calling a spade a bloody shovel. > Be considerate. Be respectful. -- Steven -- https://mail.python.org/mai

Re: Rule of order for dot operators?

2015-05-19 Thread Thomas 'PointedEars' Lahn
Ned Batchelder wrote: > On Tuesday, May 19, 2015 at 6:33:46 PM UTC-4, Thomas 'PointedEars' Lahn > wrote: >> Denis McMahon wrote: >> > On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: >> >> On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: >> >>> C.D. Reimer wrote: >> >>> ^^^

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wed, 20 May 2015 10:31 am, Gregory Ewing wrote: > Steven D'Aprano wrote: >> Chris, that is one of the best explanations for why "references equals >> pointers" is *not* a good explanation for Python's behaviour. > > Many people here seem to have lost sight of the > fact that the word "pointer"

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread Denis McMahon
On Tue, 19 May 2015 12:26:05 -0700, umasrinath88 wrote: > I have shared c file with you.Iorder to convert to unix format csv, > below are the main steps we can follow. What you're trying to do doesn't match with what you're explaining here. What you're actually trying to do is extract a constant

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Tue, 19 May 2015 09:00 pm, Gregory Ewing wrote: > Chris Angelico wrote: >> 1) Pointer arithmetic simply doesn't exist in Python. Arrays/lists are >> not just pointers to their first elements, and subscripting is most >> definitely NOT "add to pointer and dereference". >> 2) In fact, dereferenci

Re: Rule of order for dot operators?

2015-05-19 Thread Ned Batchelder
On Tuesday, May 19, 2015 at 6:33:46 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > Denis McMahon wrote: > > > On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: > >> On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: > >>> C.D. Reimer wrote: > >>> > >>> Who? > >> Don't be a

Re: Best way to rewrite Popen

2015-05-19 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do this? > So cr

Re: Best way to rewrite Popen

2015-05-19 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do this? > So cr

Re: fork/exec & close file descriptors

2015-05-19 Thread Gregory Ewing
On Tue, May 19, 2015 at 8:54 AM, Chris Angelico > wrote: On Linux (and possibly some other Unixes), /proc/self/fd may be of use. On MacOSX, /dev/fd seems to be the equivalent of this. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wed, 20 May 2015 04:19 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Wed, 20 May 2015 01:59 am, Marko Rauhamaa wrote: >>> You're slaying straw men. >> >> "I was wrong, but I don't want to admit it" is not spelled "straw man". >> >> You made a claim that was not defensible, and I tore t

Re: Slices time complexity

2015-05-19 Thread Ben Finney
Gregory Ewing writes: > If I draw two boxes on a blackboard with an arrow between them, I > think it's perfectly reasonable to call that arrow a pointer. Right. So the box with an arrow coming out of it is a good metaphor for pointers — *in languages that have pointers*, which Python does not.

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Wednesday 20 May 2015 01:20 CEST schreef MRAB: > On 2015-05-19 23:23, Cecil Westerhof wrote: >> Op Tuesday 19 May 2015 23:28 CEST schreef Jon Ribbens: >> >>> On 2015-05-19, Cecil Westerhof wrote: It looks like that this does what I want (the dot is needed so that it also works with 2

Re: Slices time complexity

2015-05-19 Thread Gregory Ewing
Steven D'Aprano wrote: Chris, that is one of the best explanations for why "references equals pointers" is *not* a good explanation for Python's behaviour. Many people here seem to have lost sight of the fact that the word "pointer" existed in the English language long before C, and even long b

Re: Best way to rewrite Popen

2015-05-19 Thread MRAB
On 2015-05-19 23:23, Cecil Westerhof wrote: Op Tuesday 19 May 2015 23:28 CEST schreef Jon Ribbens: On 2015-05-19, Cecil Westerhof wrote: It looks like that this does what I want (the dot is needed so that it also works with 2.7): files = sorted(os.listdir('.')) p = re.compile('actions-2015-05

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 23:28 CEST schreef Jon Ribbens: > On 2015-05-19, Cecil Westerhof wrote: >> It looks like that this does what I want (the dot is needed so that >> it also works with 2.7): files = sorted(os.listdir('.')) p = >> re.compile('actions-2015-05-[0-9][0-9].sql$') current_month = [

Re: Rule of order for dot operators?

2015-05-19 Thread Thomas 'PointedEars' Lahn
Denis McMahon wrote: > On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: >> On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: >>> C.D. Reimer wrote: >>> >>> Who? >> Don't be a dick, Thomas. > > Thomas is a professional dick, he can't help it, he's been a professional >

نتيجة الشهادة الابتدائية 2015

2015-05-19 Thread محمود
نتيجة الشهادة الابتدائية 2015 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550?fref=ts --

نتيجة الشهادة الابتدائية 2015 معرفة النتيجة برقم الجلوس اليوم السابع

2015-05-19 Thread شيسبس
نتيجة الشهادة الابتدائية 2015 معرفة النتيجة برقم الجلوس اليوم السابع https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > It looks like that this does what I want (the dot is needed so that it > also works with 2.7): > files = sorted(os.listdir('.')) > p = re.compile('actions-2015-05-[0-9][0-9].sql$') > current_month = [ file for file in files if p.match(file) ] Yo

Re: Help with Regular Expression

2015-05-19 Thread Tim Chase
On 2015-05-19 06:42, massi_...@msn.com wrote: > I succesfully wrote a regex in python in order to substitute all > the occurences in the form $"somechars" with another string. Here > it is: > > re.sub(ur"""(?u)(\$\"[^\"\\]*(?:\\.[^\"\\]*)*\")""", newstring, > string) The expression is a little mo

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 21:13 CEST schreef Cecil Westerhof: > Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > >> On 2015-05-19, Cecil Westerhof wrote: >>> At the moment I am playing with things like: p = >>> subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) >>> >>> I think

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > >> On 2015-05-19, Cecil Westerhof wrote: >>> At the moment I am playing with things like: p = >>> subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) >>> >>> I think that most of the tim

Re: Slices time complexity

2015-05-19 Thread Serhiy Storchaka
On 19.05.15 18:15, Ian Kelly wrote: On May 19, 2015 4:16 AM, "Serhiy Storchaka" mailto:storch...@gmail.com>> wrote: > > On 19.05.15 12:45, Steven D'Aprano wrote: >> >> On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: >>> >>> From the above link it seems slices work in linear time on a

Re: Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > On 2015-05-19, Cecil Westerhof wrote: >> At the moment I am playing with things like: p = >> subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) >> >> I think that most of the times this are the values I want. So it >> would b

Re: subprocess.getstatusoutput does not exist in 2.7

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 19:37 CEST schreef Jon Ribbens: > On 2015-05-19, Cecil Westerhof wrote: >> At the moment I want my code to run with 2.7 and 3.4+. >> >> But the command: subprocess.getstatusoutput does not exist in 2.7. >> Is this an oversight or is there a reason for it? >> >> I can rewrit

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread Grant Edwards
On 2015-05-19, umasrinat...@gmail.com wrote: > I have a python script file which converts .hex file to c file. > > Can anyone help me in converting .c file to csv file (unix format). #import os,sys os.rename(sys.argv[1],sy

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread umasrinath88
On Tuesday, May 19, 2015 at 11:51:20 PM UTC+5:30, Denis McMahon wrote: > On Tue, 19 May 2015 09:30:15 -0700, umasrinath88 wrote: > > > I have a python script file which converts .hex file to c file. > > Hex is generally an ascii file containing hexadecimal values. > > .c is generally an ascii f

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread Denis McMahon
On Tue, 19 May 2015 09:30:15 -0700, umasrinath88 wrote: > I have a python script file which converts .hex file to c file. Hex is generally an ascii file containing hexadecimal values. .c is generally an ascii file formatted in a way that corrsponds to the structures of the c programming langua

Re: Slices time complexity

2015-05-19 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 20 May 2015 01:59 am, Marko Rauhamaa wrote: >> You're slaying straw men. > > "I was wrong, but I don't want to admit it" is not spelled "straw man". > > You made a claim that was not defensible, and I tore that claim to shreds. > Have the good grace to admit that your e

Re: Best way to rewrite Popen

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 3:55 AM, Zachary Ware wrote: >> def capture_stdout(*a, **kw): >> if 'stdout' not in kw: kw['stdout'] = subprocess.PIPE > > Just a quick note that this line can be simplified nicely to: > > kw.setdefault('stdout', subprocess.PIPE) Yes, in the simple case. That does requ

Re: Slices time complexity

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 3:46 AM, Steven D'Aprano wrote: > On Wed, 20 May 2015 01:59 am, Marko Rauhamaa wrote: > >> Steven D'Aprano : >> >>> To be useful, explanations ought to give the user *predictive power* >>> -- if I calculate 32767 + 1, what will Python do? >>> >>> Explanation #1 predicts tha

Re: Rule of order for dot operators?

2015-05-19 Thread Ron Adam
On 05/19/2015 02:25 AM, Chris Angelico wrote: On Tue, May 19, 2015 at 12:43 PM, Ron Adam wrote: >Having just implementing something similar for nested scopes, it turns out >it can't be operators because if it was, then the names y and z would be >resolved in the wrong scope. > > y =

Re: Best way to rewrite Popen

2015-05-19 Thread Zachary Ware
On May 19, 2015 12:48 PM, "Chris Angelico" wrote: > > On Wed, May 20, 2015 at 3:01 AM, Cecil Westerhof wrote: > > At the moment I am playing with things like: > > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > > > I think that most of the times this are the values I

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wed, 20 May 2015 01:59 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> To be useful, explanations ought to give the user *predictive power* >> -- if I calculate 32767 + 1, what will Python do? >> >> Explanation #1 predicts that Python will return 32768. >> Explanation #2 makes no prediction

Re: Best way to rewrite Popen

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 3:01 AM, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is

Re: Best way to rewrite Popen

2015-05-19 Thread Jonas Wielicki
On 19.05.2015 19:01, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way

Re: subprocess.getstatusoutput does not exist in 2.7

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > At the moment I want my code to run with 2.7 and 3.4+. > > But the command: > subprocess.getstatusoutput > does not exist in 2.7. Is this an oversight or is there a reason for > it? > > I can rewrite the code (back) to work with Popen again, but I found

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do

subprocess.getstatusoutput does not exist in 2.7

2015-05-19 Thread Cecil Westerhof
At the moment I want my code to run with 2.7 and 3.4+. But the command: subprocess.getstatusoutput does not exist in 2.7. Is this an oversight or is there a reason for it? I can rewrite the code (back) to work with Popen again, but I found the getstatusoutput elegant. -- Cecil Westerhof Sen

Best way to rewrite Popen

2015-05-19 Thread Cecil Westerhof
At the moment I am playing with things like: p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) I think that most of the times this are the values I want. So it would be nice to overrule the defaults. What is the best way to do this? So creating a function that is exactly th

Re: Slices time complexity

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 3:07 AM, Steven D'Aprano wrote: > True confession time: I've been using Python for over 15 years. For at least > 12 of those years, I've found myself feeling guilty every time I write a > loop like "for x in seq[1:]" to skip the first element, because I'm worried > about co

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread umasrinath88
On Tuesday, May 19, 2015 at 10:15:43 PM UTC+5:30, Mihamina Rakotomandimby wrote: > On 05/19/2015 07:30 PM, umasrinat...@gmail.com wrote: > > Can anyone help me in converting .c file to csv file (unix format). > > > > > Would you give a sample? Hi Mihamina, I have sent you the complete work folder

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 2:39 AM, Cecil Westerhof wrote: > By the way, what also works is: > p = None > > But it was just a try in ipython3. I would never do this in real code. > I was just curious if this would be handled correctly and it is. :-) That _may_ work, but it depends on their not b

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Wed, 20 May 2015 12:52 am, Bartc wrote: > "Steven D'Aprano" wrote in message > news:555b0621$0$2753$c3e8da3$76491...@news.astraweb.com... [...] >> I'm sure that lots of things surprise people who assume that every >> language's performance characteristics are identical. >> >> Python is not Lis

Re: Slightly OT: Seeking (python-based) project diary tool, or framework to write one

2015-05-19 Thread jkn
Hi Rustom On Tuesday, May 19, 2015 at 5:50:11 PM UTC+1, Rustom Mody wrote: > On Tuesday, May 19, 2015 at 9:59:16 PM UTC+5:30, jkn wrote: > > Hi All > > as in the title, this is a little bit OT - but since ideally I'd like a > > tool written in Python, and I know readers here have wide experien

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 17:49 CEST schreef Ian Kelly: > On Tue, May 19, 2015 at 8:44 AM, Cecil Westerhof wrote: >> I looked at the documentation. Is it necessary to do a: >> p.wait() >> afterwards? > > It's good practice to clean up zombie processes by waiting on them, > but they will also get cle

Re: Slightly OT: Seeking (python-based) project diary tool, or framework to write one

2015-05-19 Thread Rustom Mody
On Tuesday, May 19, 2015 at 9:59:16 PM UTC+5:30, jkn wrote: > Hi All > as in the title, this is a little bit OT - but since ideally I'd like a > tool written in Python, and I know readers here have wide experience of > development/collaborative workflows etc ... Occasionally the author of leo

Re: Convert c file to csv file(unix format) in python

2015-05-19 Thread Mihamina Rakotomandimby
On 05/19/2015 07:30 PM, umasrinat...@gmail.com wrote: Can anyone help me in converting .c file to csv file (unix format). Would you give a sample? -- https://mail.python.org/mailman/listinfo/python-list

Re: fork/exec & close file descriptors

2015-05-19 Thread Ethan Furman
On 05/19/2015 05:59 AM, Skip Montanaro wrote: Due to presumed bugs in an underlying library over which I have no control, I'm considering a restart in the wee hours of the morning. The basic fork/exec dance is not a problem, but how do I discover all the open file descriptors in the new child

Convert c file to csv file(unix format) in python

2015-05-19 Thread umasrinath88
Hi All, I have a python script file which converts .hex file to c file. Can anyone help me in converting .c file to csv file (unix format). Regards, Uma -- https://mail.python.org/mailman/listinfo/python-list

Slightly OT: Seeking (python-based) project diary tool, or framework to write one

2015-05-19 Thread jkn
Hi All as in the title, this is a little bit OT - but since ideally I'd like a tool written in Python, and I know readers here have wide experience of development/collaborative workflows etc ... A few jobs ago the company I was with used a 'Project Diary' tool which I found very useful. It was

Re: Slices time complexity

2015-05-19 Thread Marko Rauhamaa
Steven D'Aprano : > To be useful, explanations ought to give the user *predictive power* > -- if I calculate 32767 + 1, what will Python do? > > Explanation #1 predicts that Python will return 32768. > Explanation #2 makes no prediction at all. Any semantic ruleset that correctly predicts the beh

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Ian Kelly
On Tue, May 19, 2015 at 8:44 AM, Cecil Westerhof wrote: > I looked at the documentation. Is it necessary to do a: > p.wait() > afterwards? It's good practice to clean up zombie processes by waiting on them, but they will also get cleaned up when your script exits. -- https://mail.python.org/

Re: Slices time complexity

2015-05-19 Thread Ian Kelly
On May 19, 2015 4:16 AM, "Serhiy Storchaka" wrote: > > On 19.05.15 12:45, Steven D'Aprano wrote: >> >> On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: >>> >>> From the above link it seems slices work in linear time on all cases. >> >> >> I wouldn't trust that is always the case, e.g. deleti

Re: fork/exec & close file descriptors

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 12:31 AM, Skip Montanaro wrote: > On Tue, May 19, 2015 at 8:54 AM, Chris Angelico wrote: >> >> On Linux (and possibly some other Unixes), /proc/self/fd may be of >> use. > > > Good point. Yes, /proc/PID/fd appears to contain all the entries for open > file descriptors (I a

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Cecil Westerhof
Op Tuesday 19 May 2015 15:16 CEST schreef Oscar Benjamin: > On 19 May 2015 at 13:24, Cecil Westerhof wrote: >> I have the following code: >> from __future__ import division, print_function >> >> import subprocess >> >> p = subprocess.Popen('ls -l', shell = True, stdout = >> subprocess.PIPE) f

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Thomas Rachel
Am 19.05.2015 um 15:16 schrieb Oscar Benjamin: However the normal way to do this is to iterate over stdout directly: Depends. There may be differences when it comes to buffering etc... Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: fork/exec & close file descriptors

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Skip Montanaro wrote: > Yeah, I'm still on 2.7, and am aware of PEP 446. Note that many of the file > descriptors will not have been created by my Python code. They will have > been created by underlying C/C++ libraries, so I can't guarantee which > flags were set on file open. The

Re: fork/exec & close file descriptors

2015-05-19 Thread Skip Montanaro
On Tue, May 19, 2015 at 8:54 AM, Chris Angelico wrote: > On Linux (and possibly some other Unixes), /proc/self/fd may be of > use. > Good point. Yes, /proc/PID/fd appears to contain all the entries for open file descriptors (I am on Linux). Skip -- https://mail.python.org/mailman/listinfo/pyth

Re: Slices time complexity

2015-05-19 Thread Oscar Benjamin
On 19 May 2015 at 09:50, Chris Angelico wrote: > On Tue, May 19, 2015 at 6:39 PM, Marko Rauhamaa wrote: >> For example, you could explain Python's object references as pointers >> (memory addresses) if you considered that helpful. (That's how Lisp >> textbooks often explain cons cells.) > > Sorta

Re: fork/exec & close file descriptors

2015-05-19 Thread Chris Angelico
On Tue, May 19, 2015 at 11:44 PM, Skip Montanaro wrote: > > On Tue, May 19, 2015 at 8:33 AM, Chris Angelico wrote: >> >> What Python version are you targeting? Are you aware of PEP 446? > > > Yeah, I'm still on 2.7, and am aware of PEP 446. Note that many of the file > descriptors will not have b

Re: Slices time complexity

2015-05-19 Thread Bartc
"Steven D'Aprano" wrote in message news:555b0621$0$2753$c3e8da3$76491...@news.astraweb.com... > On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: >> And this really has a big impact on certain operations. For instance, >> the code below may surprise some people when they realize it doesn't >>

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Tue, 19 May 2015 07:35 pm, Marko Rauhamaa wrote: > Chris Angelico : > >> Sorta-kinda-maybe, but if a C programmer's idea of pointers is invoked >> to explain Python's object references, the differences will start to >> be problematic: >> >> 1) Pointer arithmetic simply doesn't exist in Python.

Help with Regular Expression

2015-05-19 Thread massi_srb
Hi everyone, I succesfully wrote a regex in python in order to substitute all the occurences in the form $"somechars" with another string. Here it is: re.sub(ur"""(?u)(\$\"[^\"\\]*(?:\\.[^\"\\]*)*\")""", newstring, string) Now I would need to exclude from the match all the string in the form $"

Re: fork/exec & close file descriptors

2015-05-19 Thread Skip Montanaro
On Tue, May 19, 2015 at 8:33 AM, Chris Angelico wrote: > What Python version are you targeting? Are you aware of PEP 446? Yeah, I'm still on 2.7, and am aware of PEP 446. Note that many of the file descriptors will not have been created by my Python code. They will have been created by underlyi

Re: fork/exec & close file descriptors

2015-05-19 Thread Chris Angelico
On Tue, May 19, 2015 at 10:59 PM, Skip Montanaro wrote: > Due to presumed bugs in an underlying library over which I have no control, > I'm considering a restart in the wee hours of the morning. The basic > fork/exec dance is not a problem, but how do I discover all the open file > descriptors in

Re: Slices time complexity

2015-05-19 Thread Chris Angelico
On Tue, May 19, 2015 at 10:42 PM, Steven D'Aprano wrote: > On Tue, 19 May 2015 06:50 pm, Chris Angelico wrote: > >> On Tue, May 19, 2015 at 6:39 PM, Marko Rauhamaa wrote: >>> For example, you could explain Python's object references as pointers >>> (memory addresses) if you considered that helpfu

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Oscar Benjamin
On 19 May 2015 at 13:24, Cecil Westerhof wrote: > I have the following code: > from __future__ import division, print_function > > import subprocess > > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > for line in iter(p.stdout.readline, ''): > pr

fork/exec & close file descriptors

2015-05-19 Thread Skip Montanaro
Due to presumed bugs in an underlying library over which I have no control, I'm considering a restart in the wee hours of the morning. The basic fork/exec dance is not a problem, but how do I discover all the open file descriptors in the new child process to make sure they get closed? Do I simply s

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Tue, 19 May 2015 06:50 pm, Chris Angelico wrote: > On Tue, May 19, 2015 at 6:39 PM, Marko Rauhamaa wrote: >> For example, you could explain Python's object references as pointers >> (memory addresses) if you considered that helpful. (That's how Lisp >> textbooks often explain cons cells.) > >

Why does the first loop go wrong with Python3

2015-05-19 Thread Cecil Westerhof
I have the following code: from __future__ import division, print_function import subprocess p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) for line in iter(p.stdout.readline, ''): print(line.rstrip().decode('utf-8')) p = subprocess.Popen('l

Re: Slices time complexity

2015-05-19 Thread Rustom Mody
On Tuesday, May 19, 2015 at 5:16:29 PM UTC+5:30, Rustom Mody wrote: > On Tuesday, May 19, 2015 at 12:42:50 PM UTC+5:30, Marko Rauhamaa wrote: > > I sympathize. Can you get Python without getting a language like C > > first? Can a baby be born without an umbilical cord? Can you skip Newton > > and g

Re: Slices time complexity

2015-05-19 Thread Rustom Mody
On Tuesday, May 19, 2015 at 12:42:50 PM UTC+5:30, Marko Rauhamaa wrote: > Rustom Mody : > > > However conceptually/pedagogically making a fundamenal distinction of > > timeless | time > > value | object > > immutable | mutable > > expression | statement > > function | procedure > > > > is key to g

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Tuesday 19 May 2015 18:39, Marko Rauhamaa wrote: > What I'm saying is that it doesn't matter what semantic description you > give Python constructs as long as the observed behavior is correct. You really think that it doesn't matter which of the following two explanations I give for this beha

Re: Slices time complexity

2015-05-19 Thread Rustom Mody
On Tuesday, May 19, 2015 at 1:49:31 PM UTC+5:30, Steven D'Aprano wrote: > On Tuesday 19 May 2015 15:33, Rustom Mody wrote: > > > However conceptually/pedagogically making a fundamenal distinction of > > timeless | time > > value | object > > immutable | mutable > > expression | statement > > funct

Re: Slices time complexity

2015-05-19 Thread Oscar Benjamin
On 19 May 2015 at 11:15, Serhiy Storchaka wrote: > On 19.05.15 12:45, Steven D'Aprano wrote: >> >> On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: >>> >>> From the above link it seems slices work in linear time on all cases. >> >> >> I wouldn't trust that is always the case, e.g. deleting a

Re: Slices time complexity

2015-05-19 Thread Gregory Ewing
Chris Angelico wrote: 1) Pointer arithmetic simply doesn't exist in Python. Arrays/lists are not just pointers to their first elements, and subscripting is most definitely NOT "add to pointer and dereference". 2) In fact, dereferencing as a whole isn't really a 'thing' either. At best, it happens

Re: Slices time complexity

2015-05-19 Thread Serhiy Storchaka
On 19.05.15 12:45, Steven D'Aprano wrote: On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: From the above link it seems slices work in linear time on all cases. I wouldn't trust that is always the case, e.g. deleting a contiguous slice from the end of a list could be O(1). It always ha

Re: Slices time complexity

2015-05-19 Thread Steven D'Aprano
On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: > I'd like to understand what I'm being told about slices in > https://wiki.python.org/moin/TimeComplexity > > Particularly, what's a 'del slice' and a 'set slice' and whether this > information pertains to both CPython 2.7 and 3.4. Get a sl

  1   2   >