Re: How can I debug silent failure - print no output

2016-05-28 Thread Sayth Renshaw
On Saturday, 28 May 2016 16:35:35 UTC+10, Sayth Renshaw wrote: > > > > > >Ok after printing a few things i have found an error. > > > > > >def GetArgs(): > > >'''parse XML from command line''' > > >parser = argparse.ArgumentParser() > > > > > >parser.add_argument("path", nargs="+") > >

Re: IndexError for using pandas dataframe values

2016-05-28 Thread Peter Otten
Peter Otten wrote: > Daiyue Weng wrote: > >> Hi, I tried to use DataFrame.values to convert a list of columns in a >> dataframe to a numpy ndarray/matrix, >> >> matrix = df.values[:, list_of_cols] >> >> but got an error, >> >> IndexError: only integers, slices (:), ellipsis (...), numpy.newaxi

Re: How can I debug silent failure - print no output

2016-05-28 Thread Sayth Renshaw
So how do i get argparse to read the file arguments correctly? Looking at the namespace it all gets pushed into path and extension remains empty. [sayth@localhost pyXML]$ python3 racemeeting.py data/ *.xml Namespace(extension='', path=['data/', '*.xml']) This is the section I am running parser

Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-28 Thread Steven D'Aprano
On Sat, 28 May 2016 01:53 am, Rustom Mody wrote: > On Friday, May 27, 2016 at 7:21:41 PM UTC+5:30, Random832 wrote: >> On Fri, May 27, 2016, at 05:56, Steven D'Aprano wrote: >> > On Fri, 27 May 2016 05:04 pm, Marko Rauhamaa wrote: >> > >> > > They are all ASCII derivatives. Those that aren't don'

Re: How can I debug silent failure - print no output

2016-05-28 Thread Sayth Renshaw
On Saturday, 28 May 2016 18:02:06 UTC+10, Sayth Renshaw wrote: > So how do i get argparse to read the file arguments correctly? > > Looking at the namespace it all gets pushed into path and extension remains > empty. > > [sayth@localhost pyXML]$ python3 racemeeting.py data/ *.xml > Namespace(ex

why for loop print only once after add if statement

2016-05-28 Thread jobmattcon
for item, i in enumerate(aa) print item this writing, it can print all values for item, i in enumerate(aa) if item == findit: print item this only print the first value, means it only print once then not print again, where is wrong? -- https://mail.python.org/mailman/listinfo/python-l

Re: How can I debug silent failure - print no output

2016-05-28 Thread Sayth Renshaw
On Saturday, 28 May 2016 19:44:53 UTC+10, Sayth Renshaw wrote: > On Saturday, 28 May 2016 18:02:06 UTC+10, Sayth Renshaw wrote: > > So how do i get argparse to read the file arguments correctly? > > > > Looking at the namespace it all gets pushed into path and extension remains > > empty. > >

Re: why for loop print only once after add if statement

2016-05-28 Thread Sayth Renshaw
On Saturday, 28 May 2016 20:19:23 UTC+10, meInvent bbird wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item, i in enumerate(aa) > if item == findit: > print item > > this only print the first value, means it only print once then not

Re: why for loop print only once after add if statement

2016-05-28 Thread Peter Otten
jobmatt...@gmail.com wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item, i in enumerate(aa) > if item == findit: > print item > > this only print the first value, means it only print once then not print > again, Assuming aa = ["fo

Re: why for loop print only once after add if statement

2016-05-28 Thread Steven D'Aprano
On Sat, 28 May 2016 08:19 pm, jobmatt...@gmail.com wrote: > for item, i in enumerate(aa) > print item Wrong way around. It should be: for i, item in enumerate(aa): print item For example: py> for i, item in enumerate(aa): ... print i, item ... 0 c 1 h 2 e 3 e 4 s 5 e > this writing

Anonymous hyperlinks in restructuredtext

2016-05-28 Thread Sergio Spina
>From the "restructuredtext markup specification": >Anonymous hyperlink targets consist of an explicit markup >start (".. "), two underscores, a colon, whitespace, and a >link block; there is no reference name: > >.. __: anonymous-hyperlink-target-link-block > >An alternate

Re: why for loop print only once after add if statement

2016-05-28 Thread meInvent bbird
thanks, i discover that i misunderstand i and item, they should be swapped On Saturday, May 28, 2016 at 6:19:23 PM UTC+8, meInvent bbird wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item, i in enumerate(aa) > if item == findit: > p

how to write code generator for Isabelle by using pygments?

2016-05-28 Thread meInvent bbird
how to write code generator for Isabelle by using pygments? i am thinking to write a machine learning code to generate code by learning example from Isabelle code however, after google, not much information about this. -- https://mail.python.org/mailman/listinfo/python-list

Re: why for loop print only once after add if statement

2016-05-28 Thread meInvent bbird
when read my code again, i discover this error i fixed before but forget to do for another branch of if statement now fixed On Saturday, May 28, 2016 at 6:19:23 PM UTC+8, meInvent bbird wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item,

Re: Anonymous hyperlinks in restructuredtext

2016-05-28 Thread Ned Batchelder
On Saturday, May 28, 2016 at 8:28:35 AM UTC-4, Sergio Spina wrote: > From the "restructuredtext markup specification": > > >Anonymous hyperlink targets consist of an explicit markup > >start (".. "), two underscores, a colon, whitespace, and a > >link block; there is no reference name:

Re: Anonymous hyperlinks in restructuredtext

2016-05-28 Thread Sergio Spina
Il giorno sabato 28 maggio 2016 14:37:21 UTC+2, Ned Batchelder ha scritto: > On Saturday, May 28, 2016 at 8:28:35 AM UTC-4, Sergio Spina wrote: > > From the "restructuredtext markup specification": > > > > >Anonymous hyperlink targets consist of an explicit markup > > >start (".. "), two u

Re: Anonymous hyperlinks in restructuredtext

2016-05-28 Thread Lele Gaifax
Sergio Spina writes: > I need INTERNAL hyperlink targets, not external... The difference is in how you use the two kinds of references: a named hyperlink is referenced with the name followed by a single underscore, while an anonymous one needs *two* underscores. So you have for example:: Samp

Re: Anonymous hyperlinks in restructuredtext

2016-05-28 Thread Ned Batchelder
On Saturday, May 28, 2016 at 8:58:41 AM UTC-4, Sergio Spina wrote: > Il giorno sabato 28 maggio 2016 14:37:21 UTC+2, Ned Batchelder ha scritto: > > On Saturday, May 28, 2016 at 8:28:35 AM UTC-4, Sergio Spina wrote: > > > From the "restructuredtext markup specification": > > > > > > >Anonymous

Re: Coding systems are political (was Exended ASCII and code pages)

2016-05-28 Thread Ned Batchelder
On Saturday, May 28, 2016 at 11:16:39 AM UTC-4, wxjm...@gmail.com wrote: > Le samedi 28 mai 2016 06:47:11 UTC+2, Rustom Mody a écrit : > > > ... > > [which AIUI is jmf's principal error] > > > > ... > > I'm very confident. It's only a question of time until > the rest of the world dive into this

Package setup best practice style question

2016-05-28 Thread Gerald Britton
suppose I have a simple python project setup like this: Project diectory prog.py pkg directory __init__.py mod1.py class A: In order to have class A (unqualified) available from prog.py, there are a few options that I know about. I'm currently conside

Re: Package setup best practice style question

2016-05-28 Thread Steven D'Aprano
On Sun, 29 May 2016 02:15 am, Gerald Britton wrote: > suppose I have a simple python project setup like this: > > Project diectory > prog.py > pkg directory > __init__.py > mod1.py >class A: If this is a single project, why do you set it up like this

Re: Coding systems are political (was Exended ASCII and code pages)

2016-05-28 Thread Random832
On Sat, May 28, 2016, at 00:46, Rustom Mody wrote: > Which also means that if the Chinese were to have more say in the > design of Unicode/ UTF-8 they would likely not waste swathes of prime > real-estate for almost never used control characters just in the name > of ASCII compliance There are onl

re.search - Pattern matching review

2016-05-28 Thread Ganesh Pal
Dear Python friends, I am on Python 2.7 and Linux . I am trying to extract the address "1,5,147456:8192" from the below stdout using re.search (Pdb) stdout 'linux-host-machine-1: Block Address for 1,5,27320320:8192 (block 1,5,147456:8192) --\nlinux-host-machine-1: magic 0xdeaff2fe mark_c

re.search - Pattern matching review ( Apologies re sending)

2016-05-28 Thread Ganesh Pal
Dear Python friends, I am on Python 2.7 and Linux . I am trying to extract the address "1,5,147456:8192" from the below stdout using re.search (Pdb) stdout 'linux-host-machine-1: Block Address for 1,5,27320320:8192 (block 1,5,147456:8192) --\nlinux-host-machine-1: magic 0xdeaff2fe mark_c

RE: re.search - Pattern matching review ( Apologies re sending)

2016-05-28 Thread Albert-Jan Roskam
> Date: Sat, 28 May 2016 23:48:16 +0530 > Subject: re.search - Pattern matching review ( Apologies re sending) > From: ganesh1...@gmail.com > To: python-list@python.org > > Dear Python friends, > > I am on Python 2.7 and Linux . I am trying to extract the address > "1,5,147456:8192" from the bel

Re: How can I debug silent failure - print no output

2016-05-28 Thread cs
On 28May2016 03:32, Sayth Renshaw wrote: On Saturday, 28 May 2016 19:44:53 UTC+10, Sayth Renshaw wrote: On Saturday, 28 May 2016 18:02:06 UTC+10, Sayth Renshaw wrote: > So how do i get argparse to read the file arguments correctly? > > Looking at the namespace it all gets pushed into path and

Re: Python-list Digest, Vol 152, Issue 43

2016-05-28 Thread Noah Fleiszig
Thank you and ok -- Sent from Gmail Mobile -- https://mail.python.org/mailman/listinfo/python-list

Re: Package setup best practice style question

2016-05-28 Thread Steven D'Aprano
On Sun, 29 May 2016 03:00 am, Steven D'Aprano wrote: > On Sun, 29 May 2016 02:15 am, Gerald Britton wrote: > >> suppose I have a simple python project setup like this: [...] To which I responded: > If this is a single project, why do you set it up like this? Is there a > reason why you don't ju

Re: Coding systems are political (was Exended ASCII and code pages)

2016-05-28 Thread Steven D'Aprano
On Sat, 28 May 2016 02:46 pm, Rustom Mody wrote: [...] > In idealized, simplified models like Turing models where > 3 is 111 > 7 is 111 > 100, 8364 etc I wont try to write but you get the idea! > its quite clear that bigger numbers cost more than smaller ones I'm not sure that a tally (base-1

Re: Coding systems are political (was Exended ASCII and code pages)

2016-05-28 Thread Rustom Mody
On Sunday, May 29, 2016 at 11:07:51 AM UTC+5:30, Steven D'Aprano wrote: > On Sat, 28 May 2016 02:46 pm, Rustom Mody wrote: > > [...] > > In idealized, simplified models like Turing models where > > 3 is 111 > > 7 is 111 > > 100, 8364 etc I wont try to write but you get the idea! > > its quite

Re: Coding systems are political (was Exended ASCII and code pages)

2016-05-28 Thread alister
On Sun, 29 May 2016 15:37:35 +1000, Steven D'Aprano wrote: > > [1] The worst being that my US English keyboard doesn't have a proper > curly apostrophe, forcing me to use a straight ' mark in my name like > some sort of animal. What do you expect after all US is standard engineering speak for Un

Re: re.search - Pattern matching review ( Apologies re sending)

2016-05-28 Thread Ganesh Pal
> Perhaps: > map(int, re.search(search_pat, stdout).groups()) > > > Thanks Albert map saved me many lines of code but map returns a list I will have to convert the list to string again Below is how Iam planning to teh conversion >>> block = map(int, re.search(search_pat, stdout).groups()) >>> p