csjark module

2016-09-21 Thread bezenchu
After setting up csjark (http://csjark.readthedocs.io/), I'm trying to test on of my C header files which has following statements: typedef struct { unsigned long X; __int64 Y; } abc; If I'm changing __int64 to unsigned long I'm not getting this error For the __int64 i'm getting t

Re: csjark module

2016-09-21 Thread Peter Otten
bezen...@gmail.com wrote: > After setting up csjark (http://csjark.readthedocs.io/), I'm trying to > test on of my C header files which has following statements: > > typedef struct { >unsigned long X; >__int64 Y; > } abc; > > > If I'm changing __int64 to unsigned long I'm not getting th

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Ned Batchelder
On Tuesday, September 20, 2016 at 12:48:55 PM UTC-4, ROGER GRAYDON CHRISTMAN wrote: > I am trying to find a better (i.e. more efficient) way to implement a > generator > that traverses a tree. > > The current model of the code (which is also used by a textbook I am teaching > from does this) >

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > After setting up csjark (http://csjark.readthedocs.io/), I'm trying to > > test on of my C header files which has following statements: > > > > typedef struct { > >unsigned long X; > >

Re: csjark module

2016-09-21 Thread Peter Otten
bezen...@gmail.com wrote: > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten wrote: >> bezen...@gmail.com wrote: >> >> > After setting up csjark (http://csjark.readthedocs.io/), I'm trying to >> > test on of my C header files which has following statements: >> > >> > typedef str

Re: Data Types

2016-09-21 Thread BartC
On 21/09/2016 05:03, Cai Gengyang wrote: Are there any other data types that will give you type(A) or type(B) = besides True and False? No types but any variable or expression containing True or False will be a bool type (or class bool): A = 10<20 print (type(A)) => print (10<20

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > After setting up csjark (http://csjark.readthedocs.io/), I'm trying to > >

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 4:43:47 PM UTC+3, beze...@gmail.com wrote: > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: > > bezen...@gmail.com wrote: > > > > > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten wrote: > > >> bezen...@gmail.com wrote

Re: get the sum of differences between integers in a list

2016-09-21 Thread Daiyue Weng
Hi, first of all, let me rephase the problem. For an arbitrary list of integers (the integers in the list are not necessary to be sequential), e.g. [1,2,3,6,8,9,10,11,13], if a set of consecutive integers having a difference of 1 between them, put them in a list, i.e. there are two such lists in

Re: csjark module

2016-09-21 Thread Peter Otten
bezen...@gmail.com wrote: > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: >> bezen...@gmail.com wrote: >> >> > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten >> > wrote: >> >> bezen...@gmail.com wrote: >> >> >> >> > After setting up csjark (http://cs

strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
Hi Trying to clarify why ints and strings arent treated the same. You can get a valuerror from trying to cast a non-int to an int as in int(3.0) however you cannot do a non string with str(a). Which means that you likely should use try and except to test if a user enters a non-int with valuerr

Re: get the sum of differences between integers in a list

2016-09-21 Thread Peter Otten
Daiyue Weng wrote: > Hi, first of all, let me rephase the problem. > > For an arbitrary list of integers (the integers in the list are not > necessary to be sequential), e.g. [1,2,3,6,8,9,10,11,13], > > if a set of consecutive integers having a difference of 1 between them, > put them in a list,

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread ROGER GRAYDON CHRISTMAN
Since I was asked how I got different running times for my two code fragments, I'll try to apply them to a very simple tree: 4 2 6 1 3 5 7 >def __iter__(node): > for x in iter(node._left): > yield x > yield node._value > for x in iter(nod

Re: strings and ints consistency - isinstance

2016-09-21 Thread Ned Batchelder
On Wednesday, September 21, 2016 at 10:27:15 AM UTC-4, Sayth Renshaw wrote: > Hi > > Trying to clarify why ints and strings arent treated the same. > > You can get a valuerror from trying to cast a non-int to an int as in > int(3.0) however you cannot do a non string with str(a). > > Which mean

Re: get the sum of differences between integers in a list

2016-09-21 Thread Peter Otten
Peter Otten wrote: > This is not as efficient as it should be -- the gaps are calculated twice, > the check for the first and the last position is repeated on every > iteration lots of packing and unpacking... -- To address some of my own criticism: def lonely(triple): left, value, right =

Re: automated comparison tool

2016-09-21 Thread Andrew Clark
On Tuesday, September 20, 2016 at 7:48:20 PM UTC-5, Steve D'Aprano wrote: > On Wed, 21 Sep 2016 07:20 am, Andrew Clark wrote: > > > I've restarted my code so many times i no longer have a working version of > > anything. > > > *Restarting* your code doesn't change it and cannot possibly stop it

Re: get the sum of differences between integers in a list

2016-09-21 Thread marco . nawijn
On Wednesday, September 21, 2016 at 4:14:10 PM UTC+2, Daiyue Weng wrote: > Hi, first of all, let me rephase the problem. > > For an arbitrary list of integers (the integers in the list are not > necessary to be sequential), e.g. [1,2,3,6,8,9,10,11,13], > > if a set of consecutive integers having

Re: automated comparison tool

2016-09-21 Thread Andrew Clark
I reinstalled paramiko and now i'm getting a slighty different error but still says no cryptography. Traceback (most recent call last): File "C:\Users\ac40935\workspace\AutoCompare\filecmp.py", line 6, in from paramiko import SSHConfig, SSHClient File "C:\Python35-32\lib\site-packages\p

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Chris Angelico
On Thu, Sep 22, 2016 at 12:39 AM, ROGER GRAYDON CHRISTMAN wrote: > Which only highlights my disappointment that my tree > traversal itself was O(n log n), unless I gave up on yield. > As a teacher I'm stuck with either > a) a data structure that can only get its maximal speed >by not having an

Re: pypy on windows much slower than linux/mac when using complex number type?

2016-09-21 Thread Irmen de Jong
On 21-9-2016 1:20, Chris Kaynor wrote: > > Regarding the performance decrease, it may be worthwhile to push the report > to a PyPy specific forum - a PyPy developer will probably see it here, but > you may get a faster response on a forum specific to PyPy. You're right. I don't know the best pl

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Random832
On Wed, Sep 21, 2016, at 10:39, ROGER GRAYDON CHRISTMAN wrote: > Which only highlights my disappointment that my tree > traversal itself was O(n log n), unless I gave up on yield. Or you can give up on recursion. Recursive tree traversal is generally associated with passing in a callback in rather

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Ian Kelly
On Tue, Sep 20, 2016 at 11:03 AM, Rob Gaddi wrote: > The only thing that's O(N log N) in that is the number of actual yield > calls. If you're doing pretty much anything with those values as > they're being iterated over then they'll dominate the timing, and that > is O(N). It's fair to say that

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Chris Angelico
On Thu, Sep 22, 2016 at 3:15 AM, Random832 wrote: > Or you can give up on recursion. Recursive tree traversal is generally > associated with passing in a callback in rather than implementing an > iterable-like interface that can be used with a caller's for-loop > anyway. > Maybe in languages that

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Chris Angelico
On Thu, Sep 22, 2016 at 3:32 AM, Ian Kelly wrote: > On Tue, Sep 20, 2016 at 11:03 AM, Rob Gaddi > wrote: >> The only thing that's O(N log N) in that is the number of actual yield >> calls. If you're doing pretty much anything with those values as >> they're being iterated over then they'll domin

Re: Another å, ä, ö question

2016-09-21 Thread Martin Schöön
Den 2016-09-20 skrev Chris Angelico : > On Wed, Sep 21, 2016 at 6:21 AM, Martin Schöön > wrote: >> Den 2016-09-19 skrev Lawrence D’Oliveiro : >>> On Tuesday, September 20, 2016 at 8:21:25 AM UTC+12, Martin Schöön wrote: But -- now I tested using emacs instead using C-c C-c to execute. N

Re: Another å, ä, ö question

2016-09-21 Thread Martin Schöön
Den 2016-09-20 skrev Peter Otten <__pete...@web.de>: > Martin Schöön wrote: > >> Den 2016-09-19 skrev Christian Gollwitzer : >>> Am 19.09.16 um 22:21 schrieb Martin Schöön: I am studying some of these tutorials: https://pythonprogramming.net/matplotlib-intro-tutorial/ >>> >>> Assuming th

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten > >> > w

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten > >> > w

Re: list or dictionary

2016-09-21 Thread Ganesh Pal
Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen to work. >>> for line in hostname: ... regex = r'(.*) is array with id {}'.format(devid) ... mo = re.search(regex, line) ... print line, regex, mo ... if mo is not None: ... print mo.group(1) ... RX-

Re: list or dictionary

2016-09-21 Thread MRAB
On 2016-09-21 19:35, Ganesh Pal wrote: Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen to work. for line in hostname: ... regex = r'(.*) is array with id {}'.format(devid) ... mo = re.search(regex, line) ... print line, regex, mo ... if mo is not None

Re: list or dictionary

2016-09-21 Thread Ganesh Pal
Thanks , and it has to be re.match() On Thu, Sep 22, 2016 at 12:18 AM, MRAB wrote: > On 2016-09-21 19:35, Ganesh Pal wrote: > >> Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen >> to work. >> >> >> for line in hostname: > ... regex = r'(.*) is array with i

Re: csjark module

2016-09-21 Thread Peter Otten
bezen...@gmail.com wrote: > On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: >> bezen...@gmail.com wrote: >> >> > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten >> > wrote: >> >> bezen...@gmail.com wrote: >> >> >> >> > On Wednesday, September 21, 2016 a

Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread Malcolm Greene
Looking for ideas on how I can obtain the raw line of text read by a CSVDictReader. I've reviewed the CSV DictReader documentation and there are no public attributes that expose this type of data. My use case is reporting malformed lines detected when my code validates the dict of data returned by

Re: how to automate java application in window using python

2016-09-21 Thread Emile
On 09/18/2016 06:37 PM, Lawrence D’Oliveiro wrote: On Monday, September 19, 2016 at 11:32:25 AM UTC+12, Michael Torrie wrote: One I've used is AutoIt. Like I said, this kind of thing can never work

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread MRAB
On 2016-09-21 21:28, Malcolm Greene wrote: Looking for ideas on how I can obtain the raw line of text read by a CSVDictReader. I've reviewed the CSV DictReader documentation and there are no public attributes that expose this type of data. My use case is reporting malformed lines detected when m

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread Oscar Benjamin
On 21 September 2016 at 21:28, Malcolm Greene wrote: > Looking for ideas on how I can obtain the raw line of text read by a > CSVDictReader. I've reviewed the CSV DictReader documentation and there > are no public attributes that expose this type of data. > > My use case is reporting malformed lin

Re: strings and ints consistency - isinstance

2016-09-21 Thread John Gordon
In Sayth Renshaw writes: > Trying to clarify why ints and strings arent treated the same. Because they are not the same. > You can get a valuerror from trying to cast a non-int to an int as in > int(3.0) however you cannot do a non string with str(a). Anything you type can be represented as

Re: automated comparison tool

2016-09-21 Thread Kalos Kalyre
On 2016-09-21 08:55, Andrew Clark wrote: > I reinstalled paramiko and now i'm getting a slighty different error but > still says no cryptography. > > Traceback (most recent call last): > File "C:\Users\ac40935\workspace\AutoCompare\filecmp.py", line 6, in > > from paramiko import SSHConfi

Re: strings and ints consistency - isinstance

2016-09-21 Thread Steve D'Aprano
On Thu, 22 Sep 2016 12:26 am, Sayth Renshaw wrote: > Hi > > Trying to clarify why ints and strings arent treated the same. Because ints and strings are different? :-) > You can get a valuerror from trying to cast a non-int to an int as in > int(3.0) however you cannot do a non string with str(

Re: automated comparison tool

2016-09-21 Thread Steve D'Aprano
On Thu, 22 Sep 2016 01:55 am, Andrew Clark wrote: > I reinstalled paramiko and now i'm getting a slighty different error but > still says no cryptography. [...] > ImportError: No module named 'cryptography' You appear to be missing a dependency of paramiko. You need to identify which "cryptogr

Re: get the sum of differences between integers in a list

2016-09-21 Thread Steve D'Aprano
On Thu, 22 Sep 2016 01:51 am, marco.naw...@colosso.nl wrote: > And here is a straightforward one without any helpers: Please don't do people's homework for them. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.p

Re: Data Types

2016-09-21 Thread Steve D'Aprano
On Wed, 21 Sep 2016 10:25 pm, BartC wrote: > On 21/09/2016 05:03, Cai Gengyang wrote: > >> Are there any other data types that will give you type(A) or type(B) = >> besides True and False? > > No types but any variable or expression containing True or False will be > a bool type (or class bool)

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 10:09:25 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten > >> >

Re: csjark module

2016-09-21 Thread bezenchu
On Thursday, September 22, 2016 at 5:51:43 AM UTC+3, beze...@gmail.com wrote: > On Wednesday, September 21, 2016 at 10:09:25 PM UTC+3, Peter Otten wrote: > > bezen...@gmail.com wrote: > > > > > On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > > >> bezen...@gmail.com wrote

Re: strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
To answer all the good replies. I adapted a simple vector example from the Springer book practical primer on science with python. Having solved the actual problem I thought checking with the user they had the correct entries or would like to ammend them would be a good addition. This leads to

Re: Cython taking more time than regular Python

2016-09-21 Thread Lawrence D’Oliveiro
On Wednesday, September 21, 2016 at 6:05:07 PM UTC+12, Gregory Ewing wrote: > > Christian Gollwitzer wrote: > >> It may take a microsecond to call a functino from Python. > > Obviously the compiler used was a "dump" compiler. :-) Don’t forget “functino”. :) For some reason it awakens half-rememb

Re: strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
This ends being the code I can use to get it to work, seems clear and pythonic, open to opinion on that :-) answer = input("\t >> ") if isinstance(int(answer), int) is True: raise ValueError("Ints aren't valid input") sys.exit() elif isinstance(answer, str) is True: print(v0 * t

Re: Data Types

2016-09-21 Thread Sayth Renshaw
> > > >> Are there any other data types that will give you type(A) or type(B) = > >> besides True and False? > > > > No types but any variable or expression containing True or False will be > > a bool type (or class bool): > > "Containing" True or False? Certainly not: > > py> type( [1, 2, Tr

How to import all things defined the files in a module directory in __init__.py?

2016-09-21 Thread Peng Yu
Hi, Suppose that I have file1.py, ..., filen.py in a module directory. I want to import all the thing (or the ones available in the respective __all__) defined in each of the file by putting the following lines in __init__.py from file1 import * from filen import * However, I don't want to

Is there any currently-working 3rd party snapchat API for python?

2016-09-21 Thread hhkieu
Which one do you use? I want to build a snapchat bot that downloads video sent to my account, and uploads it to my story! -- https://mail.python.org/mailman/listinfo/python-list

Where is import defined in the source code? (python 2)

2016-09-21 Thread Peng Yu
Hi, I want know where import is defined in the source code. Is it implemented using __import__? -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list

Re: How to import all things defined the files in a module directory in __init__.py?

2016-09-21 Thread Ben Finney
Peng Yu writes: > I want to import all the thing (or the ones available in the > respective __all__) defined in each of the file by putting the > following lines in __init__.py > > from file1 import * > > from filen import * > > However, I don't want to hardcode the file names in __init__.py

Pasting code into the cmdline interpreter

2016-09-21 Thread Veek M
I wanted to test this piece of code which is Kate (editor) on the cmd line python >>> prompt: tex_matches = re.findall(r'(\\\w+{.+?})|(\\\w+)', msg) for tex_word in tex_matches: repl = unicode_tex.tex_to_unicode_map.get(tex_word) if repl is None: repl = 'err' msg = re.sub(re.e

Re: Pasting code into the cmdline interpreter

2016-09-21 Thread Ben Finney
Veek M writes: > 1. I had to turn on highlighting to catch mixed indent (which is a > good thing anyways so this was resolved - not sure how tabs got in > anyhow) The EditorConfig system is a growing consensus for configuring a code base to instruct text editors not to mangle it. See the Edit

Re: Cython taking more time than regular Python

2016-09-21 Thread Gregory Ewing
Lawrence D’Oliveiro wrote: Don’t forget “functino”. :) ... is that the gauge boson for the function field? Or is that a “functon”? One of them might be spin-½ ... A functino would be the supersymmetric partner of a bosonic function. For a fermionic function, its partner would be a sfunction.

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-21 Thread dieter
dl l writes: > I understood call PyGC_collect to release object cycles. But in my python > test code, seems there is NO reference cycle on the Simple object in the > python test code. Why needs to call PyGC_Collect() here? > > = > > class Sim

Re: Pasting code into the cmdline interpreter

2016-09-21 Thread Christian Gollwitzer
Am 22.09.16 um 07:12 schrieb Veek M: I wanted to test this piece of code which is Kate (editor) on the cmd line python >>> prompt: 2. Blank lines in my code within the editor are perfectly acceptable for readability but they act as a block termination on cmd line. So if i paste: tex_matches = re.

Re: Pasting code into the cmdline interpreter

2016-09-21 Thread Veek M
Ben Finney wrote: > Veek M writes: > >> 1. I had to turn on highlighting to catch mixed indent (which >> is a good thing anyways so this was resolved - not sure how tabs got >> in anyhow) > > The EditorConfig system is a growing consensus for configuring a code > base to instruct text editors

Re: Pasting code into the cmdline interpreter

2016-09-21 Thread Ben Finney
Veek M writes: > Ben Finney wrote: > > > Since you are writing code into a module file, why not just run the > > module from that file with the non-interactive Python interpreter? > > > It's part of a hexchat plugin/addon.. Which tells me that it still isn't appropriate to copy-paste the code d