Re: Help with regular expression in python

2011-08-18 Thread Martin Komoň
You don't seem to account for the whitespace between the floats. Try
> '([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?\s+){32}'
(just added \s+).

Martin

On 8/18/2011 9:49 PM, Matt Funk wrote:
> Hi,
> i am sorry if this doesn't quite match the subject of the list. If someone 
> takes offense please point me to where this question should go. Anyway, i 
> have 
> a problem using regular expressions. I would like to match the line:
> 
> 1.002000e+01 2.037000e+01 2.128000e+01 1.908000e+01 1.871000e+01 1.914000e+01 
> 2.007000e+01 1.664000e+01 2.204000e+01 2.109000e+01 2.209000e+01 2.376000e+01 
> 2.158000e+01 2.177000e+01 2.152000e+01 2.267000e+01 1.084000e+01 1.671000e+01 
> 1.888000e+01 1.854000e+01 2.064000e+01 2.00e+01 2.20e+01 2.139000e+01 
> 2.137000e+01 2.178000e+01 2.179000e+01 2.123000e+01 2.201000e+01 2.15e+01 
> 2.15e+01 2.199000e+01 : (instance: 0) :   some description
> 
> The number of floats can vary (in this example there are 32). So what i 
> thought 
> i'd do is the following:
> instance_linetype_pattern_str = '([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)
> {32}'
> instance_linetype_pattern = re.compile(instance_linetype_pattern_str)
> Basically the expression in the first major set of paranthesis matches a 
> scientific number format. The '{32}' is supposed to match the previous 32 
> times. However, it doesn't. I  can't figure out why this does not work. I'd 
> really like to understand it if someone can shed light on it.
> 
> thanks
> matt
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Strange location for a comma

2015-09-03 Thread Martin Komoň
In this case those are not tuples but rather arguments in a function
call. The extra comma does not change the evaluation, my guess is that
it is there for easier adding/removing arguments without having to care
about trailing commas.

Martin

On 03/09/15 14:28, ast wrote:
> 
> "ast"  a écrit dans le message de
> news:55e83afb$0$3157$426a7...@news.free.fr...
>> Hello,
>> At the end of the last line of the following program,
>> there is a comma, I dont understand why ?
>>
>> Thx
>>
>>
>> from cx_Freeze import setup, Executable
>>
>> # On appelle la fonction setup
>> setup(
>>name = "salut",
>>version = "0.1",
>>description = "Ce programme vous dit bonjour",
>>executables = [Executable("salut.py")],#  <--- HERE
>> )
>>
>>
> 
> Ok its understood, it's a 1 element only tuple
> 
> example:
> 
 A = 5,
 A
> (5,)
> 
 A = (6)
 A
> 6
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python as a replacement to PL/SQL

2011-10-24 Thread Martin Komoň
PostgreSQL supports PL/SQL, PL/TCL, PL/Python, PL/Perl and I've also
seen PL/Java add on module.

Martin

On 10/24/2011 4:59 PM, Alec Taylor wrote:
> Hmm...
> 
> What else is there besides PL/Python (for any DB) in the context of
> writing stored procedures in function?
> 
> Thanks for all suggestions,
> 
> Alec Taylor
> 
> On Tue, Oct 25, 2011 at 1:45 AM, Alain Ketterlin
>  wrote:
>> Alec Taylor  writes:
>>
>>> Is there a set of libraries for python which can be used as a complete
>>> replacement to PL/SQL?
>>
>> This doesn't make much sense: PL/SQL lets you write server-side code,
>> i.e., executed by the DBMS. Oracle can't execute python code directly,
>> so python can only be used on the client side (I meant "client of the
>> DBMS"), i.e., not to write stored procedures. There is no "complete
>> replacement" of PL/SQL besides Java.
>>
>> This page shows you how to _call_ PL/SQL procedures from a python script:
>>
>> http://www.oracle.com/technetwork/articles/dsl/python-091105.html
>>
>>> (I am speaking from the context of Oracle DB, PL/Python only works
>>> with PostgreSQL)
>>
>> PL/Python is a different beast, it lets you write stored functions in
>> python. There is no such thing, afaik, with Oracle.
>>
>> -- Alain.
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert DDL to ORM

2011-10-24 Thread Martin Komoň
Hi,

for the project I'm working on right now I've written a simple "SQL
create script to ORM generator". I use SQLalchemy as well and this
generator takes all tables and prepares classes, maps them to tables,
introspects them and creates explicit attribute definitions in the
classes. Contact me off-list for more details.

Martin

On 10/24/2011 6:30 PM, Alec Taylor wrote:
> Good morning,
> 
> I'm often generating DDLs from EER->Logical diagrams using tools such
> as PowerDesigner and Oracle Data Modeller.
> 
> I've recently come across an ORM library (SQLalchemy), and it seems
> like a quite useful abstraction.
> 
> Is there a way to convert my DDL to ORM code?
> 
> Thanks for all suggestions,
> 
> Alec Taylor
-- 
http://mail.python.org/mailman/listinfo/python-list