Re: Python in financial services

2014-08-19 Thread Laurent Pointal
wxjmfa...@gmail.com wrote:

 I recommend to toy intensively with the 'EURO SIGN' in
 strings manipulations.
 
 Py3: It may luckily work, Python may crash or fails (it raises
 unicode errors on valid string!).
 
 Py2: It is safer and solid. There is however a subtility. 3rd
 party tools may consider the Euro as byte or as unicode and/or
 are missinterpreting it, leading to a huge missmatch.
 
 Example: IDLE
 
 print 'EURO' * 10
 EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO
 print u'EURO' * 10
   
 # result: nothing!
 

What version of Python do you use ?

With IDLE:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type copyright, credits or license() for more information.
 print(€*10)
€€
 

With IDLE and Python 2.7, there seem to be an encoding problem:

 s = u€*10
  import sys
 sys.stdout.encoding
'utf-8'
 print s.encode(utf-8)
€€€€€€€€€€
 print s.encode(latin1)
€€

But with python2 on console, it works nicely:

laurent@litchi:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more 
information.
 s = u'€'
 s*10
u'\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac'
 print s*10
€€

 This is not specific to the Euro. I let as an
 exercise to *understand* which chars are suffering
 from this issue. (Py2 and Py3)
 
 jmf
 
 PS Go, Ruby, C#, TeX (unicode engines): never meet a problem.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-19 Thread Terry Reedy

On 8/19/2014 12:35 PM, Laurent Pointal wrote:

wxjmfa...@gmail.com wrote:



Py3: It may luckily work, Python may crash or fails (it raises
unicode errors on valid string!).

Py2: It is safer and solid.


The truth is that 2.7 has many unicode bugs that have been fixed in in 
various 3.x releases.  Please ignore jmf's disinformation campaign.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-19 Thread Mark Lawrence

On 19/08/2014 22:59, Terry Reedy wrote:

On 8/19/2014 12:35 PM, Laurent Pointal wrote:

wxjmfa...@gmail.com wrote:



Py3: It may luckily work, Python may crash or fails (it raises
unicode errors on valid string!).

Py2: It is safer and solid.


The truth is that 2.7 has many unicode bugs that have been fixed in in
various 3.x releases.  Please ignore jmf's disinformation campaign.



I don't believe that a single bug report has been raised by jmf during 
this two year long disinformation campaign.  Can somebody please confirm 
that I'm correct or provide references if I'm wrong.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Python in financial services

2014-08-12 Thread Rustom Mody
Ive been asked to formulate a python course for financial services folk.

If I actually knew about the subject, I'd have fatter pockets!
Anyway heres some thoughts. What I am missing out?

[Apart from basic python -- contents typically needs tailoring to the audience] 
the following:

- Libraries -- Decimal?
- scripts -- philosophy and infrastructure eg argparse, os.path
- Pandas
- Numpy Scipy (which? how much?)
- ipython + matplotlib + ??
- Database interfacing
- Excel interfacing (couple of libraries.. which?)
- C(C++?) interfacing paradigms -- ranging from ctypes, cython to classic 
lo-level
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-12 Thread Johann Hibschman
Rustom Mody rustompm...@gmail.com writes:

 Ive been asked to formulate a python course for financial services
 folk.

 If I actually knew about the subject, I'd have fatter pockets!
 Anyway heres some thoughts. What I am missing out?

Good luck!  It's a pretty broad field, so everyone probably has
different needs.

 - Libraries -- Decimal?

I've never seen decimal used, even though it makes sense for
accounting-style finance.  I've mostly been looking at forecasts,
trading, and risk, where floats are fine.  So maybe mention that it
exists, so people know where to look if they need it, but don't stress
it.

 - scripts -- philosophy and infrastructure eg argparse, os.path

Basic argparse is very handy, but, again, I wouldn't spend too much time
on it.

 - Pandas
 - Numpy Scipy (which? how much?)

For me, pandas is huge, numpy is a nice fundamental substrate, while
only bits and pieces of scipy are used (mostly optimization).
statsmodels may also be worth a mention, as the answer to how do I do a
regression.

 - ipython + matplotlib + ??

Ipython notebook + matplotlib is great.  At least show that it exists.
pandas plots may be enough, though.

 - Database interfacing

Definitely mention.

 - Excel interfacing (couple of libraries.. which?)

Meh, maybe.  At least give a strategy.  It always seems like a fool's
errand, though: I end up just dumping data to CSV and using that.

 - C(C++?) interfacing paradigms -- ranging from ctypes, cython to
   classic lo-level

Probably not, but it depends on the audience.  The overview, like
ctypes will link to C-like libraries, cython lets you write python-like
code that runs fast, and there's SWIG and Boost.Python if you want to
write your own modules is about all you need.

Hope that helps,
Johann
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-12 Thread Denis McMahon
On Tue, 12 Aug 2014 00:33:11 -0700, Rustom Mody wrote:

 Ive been asked to formulate a python course for financial services folk.

I wouldn't worry too much about c or c++ interfacing paradigms.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-12 Thread Rustom Mody
On Tuesday, August 12, 2014 9:05:44 PM UTC+5:30, Johann Hibschman wrote:
 Rustom Mody writes:

  - Pandas
  - Numpy Scipy (which? how much?)

 For me, pandas is huge, numpy is a nice fundamental substrate, while
 only bits and pieces of scipy are used (mostly optimization).
 statsmodels may also be worth a mention, as the answer to how do I do a
 regression.

statsmodels seems like something useful -- thanks for the pointer
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-12 Thread Rustom Mody
On Tuesday, August 12, 2014 9:20:16 PM UTC+5:30, Denis McMahon wrote:
 On Tue, 12 Aug 2014 00:33:11 -0700, Rustom Mody wrote:

  Ive been asked to formulate a python course for financial services folk.

 I wouldn't worry too much about c or c++ interfacing paradigms.

And I dont like teaching that stuff either :-) [especially on windows!]

However those folks have thousands of lines of C/C++ which they are porting to 
python.

So...

Thanks anyway
-- 
https://mail.python.org/mailman/listinfo/python-list



Re: Python in financial services

2014-08-12 Thread Denis McMahon
On Tue, 12 Aug 2014 10:48:14 -0700, Rustom Mody wrote:

 However those folks have thousands of lines of C/C++ which they are
 porting to python.

That begs the question: Why?

Seriously, I'd like to know what benefits they expect to achieve by doing 
so.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-12 Thread Rustom Mody
On Wednesday, August 13, 2014 12:24:12 AM UTC+5:30, Denis McMahon wrote:
 On Tue, 12 Aug 2014 10:48:14 -0700, Rustom Mody wrote:

  However those folks have thousands of lines of C/C++ which they are
  porting to python.

 That begs the question: Why?

 Seriously, I'd like to know what benefits they expect to achieve by doing 
 so.

Heh!
I asked more or less that.
Was told: We want it!

I gather its to do with agility -- faster time to incorporate and
integrate new logic into code etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in financial services

2014-08-12 Thread Larry Martell
On Tue, Aug 12, 2014 at 3:33 AM, Rustom Mody rustompm...@gmail.com wrote:
 Ive been asked to formulate a python course for financial services folk.

 If I actually knew about the subject, I'd have fatter pockets!
 Anyway heres some thoughts. What I am missing out?

 [Apart from basic python -- contents typically needs tailoring to the 
 audience] the following:

 - Libraries -- Decimal?
 - scripts -- philosophy and infrastructure eg argparse, os.path
 - Pandas
 - Numpy Scipy (which? how much?)
 - ipython + matplotlib + ??
 - Database interfacing
 - Excel interfacing (couple of libraries.. which?)
 - C(C++?) interfacing paradigms -- ranging from ctypes, cython to classic 
 lo-level

I'm not 100% sure what you're looking for. I work for a hedge fund and
we make extensive use of python. Everything from soup to nuts: ETL,
web scraping, database access (sybase, MySQL, and Oracle), log file
archiving and reaping, wrappers for backups, startup and shutdown
scripts for our C++ servers, GIUs (with wxpython), socket based
communication with C++ servers, just about every problem that comes
up.
-- 
https://mail.python.org/mailman/listinfo/python-list