Re: How to create a python extension module from a shared library?

2018-01-02 Thread Etienne Robillard
Hi James, Thanks for your input. I want to make a native Python application (uwsgictl) to dispatch FIFO commands to the master uWSGI process. uwsgictl would depend on libuwsgi.so, a uWSGI plugin included in the distribution. My goal is to use CFFI to generate python bindings for libuwsgi.s

Re: How to create a python extension module from a shared library?

2018-01-02 Thread Etienne Robillard
Here's my ffi_build.py script: https://bitbucket.org/tkadm30/libuwsgictl/src/956f6ca24f9111c1d8b3ce90cf17173a6e5ae3e2/ffi_build.py?at=default&fileviewer=file-view-default Not really sure how to preprocess the uwsgi.h header with clang.cindex in cffi. I can load the shared lib with : lib =

unicode direction control characters

2018-01-02 Thread Robin Becker
I'm seeing some strange characters in web responses eg u'\u200e28\u200e/\u200e09\u200e/\u200e1962' for a date of birth. The code \u200e is LEFT-TO-RIGHT MARK according to unicodedata.name. I tried unicodedata.normalize, but it leaves those characters there. Is there any standard way to deal w

Re: Goto

2018-01-02 Thread bartc
On 29/12/2017 18:11, Chris Angelico wrote: On Sat, Dec 30, 2017 at 4:13 AM, bartc wrote: If you want to translate code from one language to another, and the source language uses gotos, or uses control structures not available in the target language, then gotos would be very useful in the latter

Re: unicode direction control characters

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 1:30 AM, Robin Becker wrote: > I'm seeing some strange characters in web responses eg > > u'\u200e28\u200e/\u200e09\u200e/\u200e1962' > > for a date of birth. The code \u200e is LEFT-TO-RIGHT MARK according to > unicodedata.name. I tried unicodedata.normalize, but it leaves

Re: Goto

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 1:51 AM, bartc wrote: > On 29/12/2017 18:11, Chris Angelico wrote: >> >> On Sat, Dec 30, 2017 at 4:13 AM, bartc wrote: >>> >>> If you want to translate code from one language to another, and the >>> source >>> language uses gotos, or uses control structures not available in

Re: How to create a python extension module from a shared library?

2018-01-02 Thread Etienne Robillard
Hi James, Le 2018-01-02 à 09:30, James Chapman a écrit : What starts uWSGI? Is it started from a Python application or a webserver? Apologies for my lack of knowledge RE uWSGI. uWSGI is typically managed by the web server. > Any ideas how to compile lib into a python extension module wi

Re: unicode direction control characters

2018-01-02 Thread Robin Becker
On 02/01/2018 15:18, Chris Angelico wrote: On Wed, Jan 3, 2018 at 1:30 AM, Robin Becker wrote: I'm seeing some strange characters in web responses eg u'\u200e28\u200e/\u200e09\u200e/\u200e1962' for a date of birth. The code \u200e is LEFT-TO-RIGHT MARK according to unicodedata.name. I tried

Re: unicode direction control characters

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 2:36 AM, Robin Becker wrote: > On 02/01/2018 15:18, Chris Angelico wrote: >> >> On Wed, Jan 3, 2018 at 1:30 AM, Robin Becker wrote: >>> >>> I'm seeing some strange characters in web responses eg >>> >>> u'\u200e28\u200e/\u200e09\u200e/\u200e1962' >>> >>> for a date of birth

Re: How to create a python extension module from a shared library?

2018-01-02 Thread James Chapman
Hi Etienne, I'm not familiar with uSWGI, so I started here: https://uwsgi-docs.readthedocs.io/en/latest/Hooks.html AFAIK there are a number of hooks already exposed and available to Python apps. However, if I've understood your question correctly, you want to extend uWSGI itself by writing some p

Re: How to create a python extension module from a shared library?

2018-01-02 Thread James Chapman
I have an example of loading and communicating with a dynamic library using ctypes in Windows here: https://github.com/James-Chapman/python-code-snippets/tree/master/DLL_C_funcs_w_callbacks It shouldn't be too dissimilar on Linux. What starts uWSGI? Is it started from a Python application or a web

Re: How to create a python extension module from a shared library?

2018-01-02 Thread James Chapman
Again, apologies if I've dumbed this down, but if I understand this all correctly... The webserver starts uWSGI, the python application running within then does stuff via uWSGI. You want one of those things to be handled by a uWSGI extension that has been written in python, with CFFI, rather than

Where did csv.parser() go?

2018-01-02 Thread jason
I need record the starting offsets of csv rows in a database for fast seeking later. Unfortunately, using any csv.reader() (or DictReader) tries to cache, which means: example_Data = "'data 0123456789ABCDE 1123456789ABCDE 2123456789ABCDE 3123456789ABCDE ... ''' for line in reader: offsets[r

Numpy and Terabyte data

2018-01-02 Thread Rustom Mody
Someone who works in hadoop asked me: If our data is in terabytes can we do statistical (ie numpy pandas etc) analysis on it? I said: No (I dont think so at least!) ie I expect numpy (pandas etc) to not work if the data does not fit in memory Well sure *python* can handle (streams of) terabyte d

Re: Goto

2018-01-02 Thread bartc
On 02/01/2018 15:20, Chris Angelico wrote: On Wed, Jan 3, 2018 at 1:51 AM, bartc wrote: I like to write code in a simple, clean, universal style that everyone can understand. That doesn't mean it has to look like Fortran. Why are you using a Python interpreter then? Why are you here on pyt

Re: Where did csv.parser() go?

2018-01-02 Thread Peter Otten
ja...@apkudo.com wrote: > I need record the starting offsets of csv rows in a database for fast > seeking later. Unfortunately, using any csv.reader() (or DictReader) tries > to cache, which means: example_Data = "'data > 0123456789ABCDE > 1123456789ABCDE > 2123456789ABCDE > 3123456789ABCDE > ...

Re: Numpy and Terabyte data

2018-01-02 Thread jason
I'm not sure if I'll be laughed at, but a statistical sampling of a randomized sample should resemble the whole. If you need min/max then min ( min(each node) ) If you need average then you need sum( sum(each node)) sum(count(each node))* *You'll likely need to use log here, as you'll probably o

Re: Python goto

2018-01-02 Thread Rob Gaddi
On 12/28/2017 04:35 AM, Skip Montanaro wrote: Jorge> I would like to know if there is a goto command or something similar that Jorge> I can use in Python. Ned> Python does not have a goto statement. You have to use structured Ned> statements: for, while, try/except, yield, return, etc. Though i

Re: Python goto

2018-01-02 Thread Chris Angelico
On Wed, Jan 3, 2018 at 5:16 AM, Rob Gaddi wrote: > On 12/28/2017 04:35 AM, Skip Montanaro wrote: >> >> Jorge> I would like to know if there is a goto command or something >> similar that >> Jorge> I can use in Python. >> >> Ned> Python does not have a goto statement. You have to use structured >>

Re: Where did csv.parser() go?

2018-01-02 Thread jason
Wow, awesome!!! Thank you! -- https://mail.python.org/mailman/listinfo/python-list

Re: Numpy and Terabyte data

2018-01-02 Thread Irving Duran
I've never heard or done that type of testing for a large dataset solely on python, so I don't know what's the cap from the memory standpoint that python can handle base on memory availability. Now, if I understand what you are trying to do, you can achieve that by leveraging Apache Spark and invo

Re: Numpy and Terabyte data

2018-01-02 Thread Paul Moore
On 2 January 2018 at 17:24, Rustom Mody wrote: > Someone who works in hadoop asked me: > > If our data is in terabytes can we do statistical (ie numpy pandas etc) > analysis on it? > > I said: No (I dont think so at least!) ie I expect numpy (pandas etc) > to not work if the data does not fit in m

Re: Goto

2018-01-02 Thread John Wong
I think the point is there is not much to discuss. Goto is not going to be added. Furthermore, for every program language you want to translate from source, you have to find a workaround. Otherwise, your translation will only work for languages that have goto. Even so the implementation may not be

Re: How to create a python extension module from a shared library?

2018-01-02 Thread Etienne Robillard
Hi James, Part of the problem is because the CFFI and uWSGI developers aren't interested to support this. I need to modify CFFI to support preprocessing C headers with clang.cindex myself. I also need to make sure its possible to attach my Python script to the master uWSGI process to dispatc

Re: unicode direction control characters

2018-01-02 Thread Random832
On Tue, Jan 2, 2018, at 10:36, Robin Becker wrote: > >> u'\u200e28\u200e/\u200e09\u200e/\u200e1962' > > I guess I'm really wondering whether the BIDI control characters have any > semantic meaning. Most numbers seem to be LTR. > > If I saw u'\u200f12' it seems to imply that the characters should

Re: Numpy and Terabyte data

2018-01-02 Thread Rustom Mody
On Wednesday, January 3, 2018 at 1:43:40 AM UTC+5:30, Paul Moore wrote: > On 2 January 2018 at 17:24, Rustom Mody wrote: > > Someone who works in hadoop asked me: > > > > If our data is in terabytes can we do statistical (ie numpy pandas etc) > > analysis on it? > > > > I said: No (I dont think so