Re: News on versions modules for Python-2.5?

2006-10-06 Thread MC
Hi again!

Thank you, for all answers & contribs.

-- 
@-salutations

Michel Claveau


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


Re: How to execute a python script in .NET application

2006-10-07 Thread MC
Hi!

dotNET can use (call) COM-servers

In pywin, there are exemple of COM-server, in Python, who can run 
(on-the-fly) Python code.

This give a way for run Python's scripts from dotNET, Excel, Word, 
Internet-Explorer (HTA), C#, etc.  I have try all these things, with 
success.

-- 
@-salutations

Michel Claveau


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


Re: News on versions modules for Python-2.5?

2006-10-12 Thread MC
Hi!

Ok.
Downloaded.
Thanks

-- 
@-salutations

Michel Claveau


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


Re: Restart a Python COM Server

2006-10-17 Thread MC
Hi!

It is the normal behavior of COM.

Note that, Python being dynamic, you can modify Python script, OF THE 
INTERIOR, during execution.

-- 
@-salutations

Michel Claveau


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


Re: Using Python scripts in Windows Explorer

2006-10-20 Thread MC
Hi!

I use this little batch:

@echo off
cd \dev\python
viewarg.py %*

I copy/paste the batch-file on the desktop, like icon.
Then, from Win-explorer, drag_and_drop & copy_and_paste run OK.

-- 
@-salutations

Michel Claveau


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


Re: I like python.

2006-10-20 Thread MC
Hi!

Sorry, I don't understand well english.
But, try to rename your script, from .py to .pyw (sample : titi.py ==> 
titi.pyw).

-- 
@-salutations

Michel Claveau


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


subprocess decoding?

2006-10-28 Thread MC
Hi!

On win-XP (french), when I read subprocess (stdout), I must use 
differents decoding (cp1252,cp850,cp437, or no decoding), depending of 
the "launch mode" of the same Python's script:
  - from command-line
  - from start+run
  - from icon
  - by Python-COM-server
  - etc.

(.py & .pyw can also contribute)


How to know, on the fly, the encoding used by subprocess?


Thanks by advance

-- 
@-salutations

Michel Claveau


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


Re: Integrating Python with Fortran

2006-10-31 Thread MC
Hi!

in afternoon: http://calcul.math.cnrs.fr/article.php3?id_article=150

-- 
@-salutations

Michel Claveau


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


Re: Javascript is turning into Python?!

2006-11-03 Thread MC
Hi!

> (ECMAscript), then, well I haven't seen any progress there.

1) in IE-7, the last release (of JScript) has few evolutions (more 
important, a new garbage collector)

2) in Windows, with Active-Scripting, it's possible to integrate 
JScript in Python, call JScript's functions from Python's code, call 
Python's functions from JScript's code, etc.

-- 
@-salutations

Michel Claveau


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


Re: Programming Language that is Spreadsheet/Table Based

2006-11-03 Thread MC
Hi!

You can expand VBA/Excel with Python, with Pywin32 for to make a 
dynamic COM server.

-- 
@-salutations

Michel Claveau


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


Re: how do I pass values between classes?

2006-11-03 Thread MC
Hi!

Look Candygram (http://candygram.sourceforge.net/)
Candygram has features who will fun for you (like 
inter-threads-comunication).

-- 
@-salutations

Michel Claveau


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


Re: Python to tell what is the IP of my PC .

2006-11-09 Thread MC
http://monip.org/

-- 
@-salutations

Michel Claveau


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


Re: [Article] OpenOffice.org and Python

2006-09-05 Thread MC
Thanks!

But:
  - and Python 2.4.x?
  - I have Python 2.4 and then "embbed Python 2.3 of OOo" ; how install 
some things in this last Python?  I dream to call Pywin32 from OOo...
  - when I drive OOo from Python, via COM/Ole-automation, many things 
not run (getStruct...); no solution?

-- 
@-salutations

Michel Claveau


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


Re: windev vs python SOS

2006-09-28 Thread MC
Bonjour !

Comme tu es français, tu me coprendras.

Alors :
  - windev est fermé, et protégé par des dongles. Résultat : dongle 
perdu, en panne, ou volé, il faut racheter une licence (c'est arrivé à 
un ami)
  - le langage de windev est beaucoup moins évolué que Python. Et, 
quand je dis beaucoup, c'est faible... Python a des possibilités 
énormes en programmation procédurale, en Orienté Objet, et, même, en 
programmation fonctionnelle.
  - la structure interne de Python est extraordinaire. Vraiment.
  - Python est très facile à apprendre. Il existe beaucoup de 
ressources, même en français, sur Internet, dans des livres, etc.
  - Python est un langage stable, avec très très peu de bugs/problèmes. 
Sur ce point, windev marque sérieusement le pas. Sur certains forums 
consacrés à windev, le nombre de bugs signalés était effarant.
  - les librairies disponibles pour Python couvrent un spectre beaucoup 
plus large que celles disponibles pour windev
  - les bases de données intégrées à windev sont issues du vieux moteur 
"hyperfile", beaucoup trop limité. Avec Python, on peut choisir le SGBD 
que l'on veut, sans trop de soucis. Depuis SQL-lite, jusqu'à Oracle (XE 
ou autre), on peut assumer tous les niveaux de puissance nécessaire.
  - avec Python, on peut faire du multi-threading, du réparti, des 
applications web, consoles, invisibles (services), des serveurs COM, 
développer des interfaces, ou en utiliser de toutes prêtes, travailler 
sur du réseau, piloter des équipements industriels, etc. etc.
  - je n'utilise pas le "libre" comme argument, sauf pour un point : si 
pc-soft (éditeur de windev) a, un jour de grosses difficultés, le 
produit pourrait bien disparaitre soudainement, ce qui n'est pas le cas 
de Python, maintenu par une communauté. Or, il y a peu d'années, cette 
boîte a eu, justement, d'importants problèmes financiers.

Le gros point fort de windev, c'est un marketing très agressif. 
D'ailleurs, si tu veux manger et boire à l'oeil, va suivre les 
présentations.

Avant dernier point : tu aurais pu mettre ton message dans le newsgroup 
français sur Python.

Dernier point : si quelqu'un veut traduire ce message, il a mon accord 
tout entier.



-- 
@-salutations

Michel Claveau


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


Re: windev vs python SOS

2006-09-29 Thread MC
Thank you, Jean-Marc, for translation. I am not capable of this work.

:-)

-- 
@-salutations

Michel Claveau


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


Re: windev vs python SOS

2006-09-29 Thread MC
Thanks.
The essential, is that peoples (& you) can understand. Bbut, perso, I 
don't understand the message translated (much unknowed words...)

-- 
@-salutations

Michel Claveau


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


Re: file backup in windows

2006-11-22 Thread MC
Hi!

" are your friend.

See, also:
   filepath = '"%HOMEPATH%\\LocalSettings\\Application 
Data\\Microsoft\\Outlook\\*"'

and  %USERPROFILE%  %APPDATA% etc.

-- 
@-salutations

Michel Claveau


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


Re: Try to stop thread Using flag

2006-11-25 Thread MC

http://candygram.sourceforge.net/

-- 
@-salutations

Michel Claveau


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


Re: Python Plugin for Web Browser

2006-12-05 Thread MC
Bonjour !

Pour IE, il y a des exemples de plugins, fournis avec PyWin32.
Pour FF (comme pour Opera), je ne sais pas.

-- 
@-salutations

Michel Claveau


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


Re: Python Plugin for Web Browser

2006-12-06 Thread MC
Bonsoir !

> As-tu des connaissances en C++ ? avec Visual C++ ?
Ben, non, je ne pratique pas ces machins.

Par contre, je pense qu'il existe une autre démarche, qui consiste à 
générer, à la volée, en Python, des sortes d'applets java/javascript.

Avantages : rien à installer ; milti-navigateurs
Inconvénient : ça se programme côté serveur.
Voir : Pyjamas (http://pyjamas.pyworks.org/FR/overview/)

-- 
@-salutations

Michel Claveau


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


Re: Why does Python never add itself to the Windows path?

2006-12-24 Thread MC
Hi!

+1

-- 
@-salutations

Michel Claveau


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


Python - C# interoperability

2007-01-09 Thread mc
Is there an easy way to compile a Python class (or set of classes) into
a .DLL that a C# program can call?  Or otherwise to use an existing
library of Python classes from a C# program as seamlessly as possible?

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


Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread MC
Hi!

Look Candygram :  http://candygram.sourceforge.net/







-- 
@-salutations

Michel Claveau


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


Re: FTP Date Format Function

2007-06-14 Thread MC
Thank.







-- 
@-salutations

Michel Claveau


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


Re: Do eval() and exec not accept a function definition? (like 'def foo: pass) ?

2007-06-23 Thread MC
Hi!

Try with change all '\r\n'  by  '\n'

-- 
@-salutations

Michel Claveau


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


Re: python 3.0 or 3000 ....is it worth waiting??? Newbie Question

2007-07-03 Thread MC
Hi!

>> non-Ascii characters in identifiers 
>
> And this change may be already in a Python 2.x before P3K.

Good new! (if it's True...)





-- 
@-salutations

Michel Claveau


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


Re: ActivePython

2007-07-03 Thread MC
Hi!

> Why might one choose to use ActivePython instead of using the free CPython?

quiet installation?








-- 
@-salutations

Michel Claveau


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


Re: IDEs for COM scripting: C# v. Python v. Iron Python v. JPython

2007-07-05 Thread MC
Hi!

> No. The IDIspatch-interface explicitely lists what methods with what 
> arguments it has. So code completion is possible there as well.

Sorry, I think different.
In VS, assists use TLB for find methods & arguments.
Dynamic-server can't have TLB.

Other way for verify : try a Makepy on a COM server write with 
Python+Pywin32...

-- 
@-salutations

Michel Claveau


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


Re: Windows, subprocess.Popen & encodage

2007-05-08 Thread MC
Thank you.






-- 
@-salutations

Michel Claveau


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


Re: Sending a JavaScript array to Python script?

2007-05-17 Thread MC
Hi!

Which context?

I know to do interact Python <=> Jscript, with Internet-Explorer+COM ; 
but I don't know with others environment.




-- 
@-salutations

Michel Claveau


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


Re: Syntax Question - list multiplication

2007-08-19 Thread MC
Classic

-- 
@-salutations

Michel Claveau


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


Re: How to free memory ( ie garbage collect) at run time with Python 2.5.1(windows)

2007-08-27 Thread MC
Hi!

For windows, I had a soft for this (reduce_memory.exe). Sorry, it's not 
write with Python.

If you want, I will give a URL for download it.

-- 
@-salutations

Michel Claveau


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


Re: Horace Lives!

2007-08-31 Thread MC
Mégalo!

-- 
@-salutations

Michel Claveau


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


Re: JavaScript

2007-08-31 Thread MC
Hi!

I know "how to", but only with IE on windows.

-- 
@-salutations

Michel Claveau


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


Re: [python-win32] How can I get the parentWindow.document object?

2007-09-02 Thread MC
Hi!

> ie = win32com.client.Dispatch("InternetExplorer.Application")
> doc=ie.Document.parentWindow.document

Use bridge variable :
   window=ie.Document.parentWindow
And work with :
   print window.Document.body.name








-- 
@-salutations

Michel Claveau


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


Re: [python-win32] How can I get the parentWindow.document object?

2007-09-02 Thread MC
Re!

Sorry! The good exemple is :

ie = win32com.client.Dispatch("InternetExplorer.Application")
window=ie.Document.parentWindow
print window.name

another :
window.alert("Aalleerrtt")

-- 
@-salutations

Michel Claveau


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


Re: shared memory pointer

2007-09-10 Thread MC
Hi!

I agree ; on windows mmap use Memory-Mapped-file, who use virtual 
memory. And shared memory use physical memory.

The difference is OS an not Python




-- 
@-salutations

Michel Claveau


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


Re: Object Oriented Database with interface for Pyhton

2007-03-30 Thread MC
Salut!

Heureusement qu'il y a qq français pour faire un peu de ménage...

-- 
@-salutations

Michel Claveau


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


Re: zip list with different length

2007-04-04 Thread MC
Hi!

Brutal, not exact answer, but:

a = range(5)
b = range(3)
print zip(a+[None]*(len(b)-len(a)),b+[None]*(len(a)-len(b)))





-- 
@-salutations

Michel Claveau


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


Re: Python - C# interoperability

2007-01-10 Thread mc
Thanks to all who responded.  It appears that there may be a solution
as follows:

use jythonc to turn Python program into Java bytecode

use Microsoft's jbimp to turn Java bytecode into .NET DLL

It sounds roundabout, but I am investigating.

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


Re: Python Windows installation

2007-11-22 Thread MC
Hi!

> 1.5.1

Sure? 1.5.1?

For Python 2.5, look ActiveState. Their distrib have silent option.







-- 
@-salutations

Michel Claveau


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


Compiling fails on Mac OS X 10.5

2008-01-12 Thread mc
Hi!
I'm trying to compile on my Macbook with OS X 10.5. I have all updates
and Xcode 3.0 installed.

I checked python out with: svn checkout 
http://svn.python.org/projects/python/branches/py3k
After that I did "./configure" in the  created "py3k" dir. Everything
went fine. But make fails with the following error message:
ranlib libpython3.0.a
gcc  -u _PyMac_Error -o python.exe \
Modules/python.o \
libpython3.0.a -ldl
make: *** [sharedmods] Error 1

I tried checking out many times. I also tried de 3.0a2 release,gives
me the same error. I've heard others have compiled it successfully on
Leopard so I wonder what causes the problems on my system.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compiling fails on Mac OS X 10.5

2008-01-12 Thread mc
On Jan 12, 5:34 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote:
> On Jan 12, 9:41 am, mc <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi!
> > I'm trying to compile on my Macbook with OS X 10.5. I have all updates
> > and Xcode 3.0 installed.
>
> > I checked python out with: svn 
> > checkouthttp://svn.python.org/projects/python/branches/py3k
> > After that I did "./configure" in the  created "py3k" dir. Everything
> > went fine. But make fails with the following error message:
> > ranlib libpython3.0.a
> > gcc  -u _PyMac_Error -o python.exe \
> > Modules/python.o \
> > libpython3.0.a -ldl
> > make: *** [sharedmods] Error 1
>
> > I tried checking out many times. I also tried de 3.0a2 release,gives
> > me the same error. I've heard others have compiled it successfully on
> > Leopard so I wonder what causes the problems on my system.
>
> Could you post the rest of the ./configure and compilation output?
> make might be rereporting an error that occurred further up.
>
> I don't see anything related on the Python bug tracker.  It might be
> worth posting a bug report at bugs.python.org
>
> Mark


Alright!
./configure output is here: http://rafb.net/p/NqSmqc25.html
and make output here: http://rafb.net/p/kzeb2e29.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is python Object oriented??

2009-01-29 Thread MC

Hi!

Il se trouve que Chris Rebert a formulé :

Python has functions, which are not associated
with a class


functions are methods of builtin...





--
@-salutations

Michel Claveau


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


Re: is python Object oriented??

2009-01-31 Thread MC

Re


‘builtin’ is not a class.


I think "object" ; not only "class"
And "builtin" is an object.




--
@-salutations

Michel Claveau


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


Re: Very Slow PythonWin 2.6.1 Startup on Windows XP SP3

2008-12-18 Thread MC

Hi!

Perhaps, if you copy DLL in others strategic places, it's better...



--
@-salutations

Michel Claveau


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


Re: Make Python create a tuple with one element in a clean way

2008-05-11 Thread MC

Hi!


You want 2*(3+4) to return (7,7)?


For have that:  2*(3+4,)




--
@-salutations

Michel Claveau


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


Mathematical Python Library

2008-04-07 Thread mc
I'm looking for a library which can do mathematical stuff like
solving  equations. Or calculation the nulls of a function and so on.
Does anyone know one?

Thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calling Python code from inside php

2008-04-23 Thread MC

Hi!

If you are under Windows, you can:
- call Python's functions via Active-Scripting
- call a Python COM server (functions or properties)

For that, use Pywin32. And, in all cases, call functions can use 
parameters.







--
@-salutations

Michel Claveau


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


Re: windows explorer integration

2009-07-11 Thread MC

Hi!

Possible!  With Pywin32.
I see two ways:
 - add a "toolBar" ; see the exemple for Internet-Explorer (it run for 
both, IE & explorer)

 - add an entry in the context menu (right click)

@-salutations
--
Michel Claveau

--
@-salutations

Michel Claveau


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


Re: Having trouble setting up an extremely simple server...

2013-11-21 Thread Cilantro MC
On Thursday, November 21, 2013 9:33:13 PM UTC-5, Roy Smith wrote:
> In article <9e773107-5a6c-486b-bef2-186101d8f...@googlegroups.com>,
> 
>  cilantr...@gmail.com wrote:
> 
> 
> 
> > I'm attempting to set up an extremely simple server that receives a string, 
> 
> > and returns a string. However, I have 2 problems. I'm able to receive the 
> 
> > string from the client fine, but it only will receive it once. After I send 
> 
> > another string from the client, it doesn't come up on the server... Also, I 
> 
> > want to send something BACK to the client-side, but I can't seem to see 
> 
> > how... Please help! I'm very new to networking, but I've been using Python 
> 
> > for a while now, just recent;y getting into networking, trying to get 
> > things 
> 
> > down.
> 
> > 
> 
> > SERVER.PY:
> 
> > 
> 
> > import socket;
> 
> > serverReady = True;
> 
> > 
> 
> > serverSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
> 
> > serverSock.bind(('localhost', 8081));
> 
> > serverSock.listen(10);
> 
> > 
> 
> > while (True):
> 
> > connection, address = serverSock.accept();
> 
> > if (serverReady):
> 
> > serverSockBuffer = connection.recv(1024);
> 
> > if (len(serverSockBuffer) > 0):
> 
> > print serverSockBuffer;
> 
> > if (raw_input("Ready?: ") in ['yes', 'y']):
> 
> > serverReady = True;
> 
> > else:
> 
> > serverReady = False;
> 
> 
> 
> First thing, get rid of all those semicolons.  This is Python you're 
> 
> writing, not C++.  Likewise, the extra parens in your while statements.
> 
> 
> 
> Your problem is that you're doing the accept() inside your main loop on 
> 
> the server.  You want to be doing it once, outside the loop.

I prefer using the semicolons... They aren't making my code wrong... I use 
other programming languages from time to time, and I'd rather just always use 
semicolons, as with the parentheses. I will try that though, moving the 
accept(). What about sending information back to the client?
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing addition libraries in Portable Python 2.7 on Windows

2014-03-16 Thread laguna-mc
I am new in Python, I have Portable Python 2.7.5.1 installed on Windows 7.

I want to install additional libraries:

python-magic
libmagic
libfuzzy
pyqtgraph

I downloaded package, saved on hard drive, unzipped, find setup.py and tried 
install via Command Prompt:

Python-Portable.exe setup.py install

A new DOS terminal window briefly flashes and disappears, without showing any 
error or installation confirmation.
I assume that nothing has been installed and/or installation failed.. No tips 
or errors has been shown, so I don't' know how to install these packages 
corretcly.
I tried also to install get-pip.py use same way, and again nothing happens, no 
any errors or results.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing addition libraries in Portable Python 2.7 on Windows

2014-03-16 Thread laguna-mc
It'slike a chain, eachnew modulepulls afew othermodules.I can postpone 
get-pip.py onthe very last stage, now I want to install python-magic, libmagic, 
libfuzzy, pyqtgraph. How to do this?

- Original Message -
From: Mark Lawrence
Sent: 03/16/14 05:06 PM
To: python-list@python.org
Subject: Re: Installing addition libraries in Portable Python 2.7 on Windows

On 16/03/2014 13:50, laguna...@mail.com wrote: > I am new in Python, I have 
Portable Python 2.7.5.1 installed on Windows 7. > > I want to install 
additional libraries: > > python-magic > libmagic > libfuzzy > pyqtgraph > > I 
downloaded package, saved on hard drive, unzipped, find setup.py and > tried 
install via Command Prompt: > > Python-Portable.exe setup.py install > > A new 
DOS terminal window briefly flashes and disappears, without > showing any error 
or installation confirmation. > I assume that nothing has been installed and/or 
installation failed.. No > tips or errors has been shown, so I don't' know how 
to install these > packages corretcly. > I tried also to install get-pip.py use 
same way, and again nothing > happens, no any errors or results. > IIRC you 
need to obtain ez_setup.py to get easy_install and only then will get-pip.py 
work. -- My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language. Mark Lawrence --- This email is f
 ree from viruses and malware because avast! Antivirus protection is active. 
http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Error when installing matplotlib-1.3. on Windows

2014-03-16 Thread laguna-mc
I'm trying to install matplotlib from locally stored source archive file 
(Portable Python 2.7 on Windows):

pip install E:\matplotlib-1.3.1.win32-py2.7.exe

Got error, below is log:


E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 03:10:16
Exception:
Traceback (most recent call last):
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py", 
line 122, in main
 status = self.run(options, args)
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\commands\install.py", line 257, in run
 InstallRequirement.from_line(name, None))
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py", line 172, 
in from_line
 return cls(req, comes_from, url=url, prereleases=prereleases)
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py", line 70, 
in __init__
 req = pkg_resources.Requirement.parse(req)
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in parse
 reqs = list(parse_requirements(s))
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in 
parse_requirements
 line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2512, in 
scan_list
 raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 
'E:\\matplotlib-1.3.1.win32-py2.7.exe', 'at', 
':\\matplotlib-1.3.1.win32-py2.7.exe')


What is the problem and how to solve it?
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing binwalk on Portable Python

2014-03-17 Thread laguna-mc
Portable Python 2.7 for Win32 and installed on USB flash drive. I want install 
Binwalk tool, it have a few depencencies, I installed it first (numpy, 
matplotlib, libmagic, python-magic)
Then I tried to install binwalk from locally stored source archive file, I 
tried two ways:

pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0.tar

pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py

I both cases I got error, below is log:

E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 21:25:47
Exception:
Traceback (most recent call last):
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py", 
line 122, in main
 status = self.run(options, args)
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\commands\install.py", line 257, in run
 InstallRequirement.from_line(name, None))
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py", line 172, 
in from_line
 return cls(req, comes_from, url=url, prereleases=prereleases)
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py", line 70, 
in __init__
 req = pkg_resources.Requirement.parse(req)
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in parse
 reqs = list(parse_requirements(s))
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in 
parse_requirements
 line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2512, in 
scan_list
 raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'E:\\Portable', 'at', ':\\Portable')
---
What is wrong with this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing binwalk on Portable Python

2014-03-17 Thread laguna-mc
I tried: pip install "E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py"

Error:

E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 22:53:51
Exception:
Traceback (most recent call last):
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py", 
line 122, in main
 status = self.run(options, args)
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\commands\install.py", line 257, in run
 InstallRequirement.from_line(name, None))
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py", line 172, 
in from_line
 return cls(req, comes_from, url=url, prereleases=prereleases)
 File "E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py", line 70, 
in __init__
 req = pkg_resources.Requirement.parse(req)
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in parse
 reqs = list(parse_requirements(s))
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in 
parse_requirements
 line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
 File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2512, in 
scan_list
 raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'E:\\Portable Python 
2.7.5.1\\binwalk-1.3.0\\src\\setup.py', 'at', ':\\Portable Python 
2.7.5.1\\binwalk-1.3.0\\src\\setup.py')


--
- Original Message -
From: Peter Mawhorter
Sent: 03/17/14 10:13 PM
To: laguna...@mail.com
Subject: Re: Installing binwalk on Portable Python

On Mon, Mar 17, 2014 at 12:56 PM,  wrote: > Portable Python 
2.7 for Win32 and installed on USB flash drive. I want > install Binwalk tool, 
it have a few depencencies, I installed it first > (numpy, matplotlib, 
libmagic, python-magic) > Then I tried to install binwalk from locally stored 
source archive file, I > tried two ways: > > pip install E:\Portable Python 
2.7.5.1\binwalk-1.3.0.tar > > pip install E:\Portable Python 
2.7.5.1\binwalk-1.3.0\src\setup.py > > I both cases I got error, below is log: 
> > E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 21:25:47 > 
Exception: > Traceback (most recent call last): > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\basecommand.py", line 122, in main > status = 
self.run(options, args) > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\commands\install.py", line 257, in run > 
InstallRequirement.from_line(name, None)) > File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\req.py", lin
 e > 172, in from_line > return cls(req, comes_from, url=url, 
prereleases=prereleases) > File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\req.py", line > 70, in __init__ > req = 
pkg_resources.Requirement.parse(req) > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in > 
parse > reqs = list(parse_requirements(s)) > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in > 
parse_requirements > line, p, specs = 
scan_list(VERSION,LINE_END,line,p,(1,2),"version spec") > File "E:\Portable 
Python > 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 
2512, in > scan_list > raise ValueError("Expected "+item_name+" 
in",line,"at",line[p:]) > ValueError: ('Expected version spec in', 
'E:\\Portable', 'at', > ':\\Portable') > 
--- > > > > What is wrong with this? > 
-- > https://mail.python.org/mailman/listinfo/python-list > From your error it
  looks like you just need quotes around the path because it has a space in it. 
-Peter Mawhorter
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing binwalk on Portable Python

2014-03-17 Thread laguna-mc
Yes, that help.
Installation start, but then failed due to "Pre-requisite failure: failed to 
find libmagic. Check your installation. Please install the python-magic module, 
or download and install it from source: ftp://ftp.astron.com/pub/file/' "
Although libmagic was installed using pip.

- Original Message -
From: Peter Mawhorter
Sent: 03/17/14 11:07 PM
To: laguna-mc
Subject: Re: Installing binwalk on Portable Python

On Mon, Mar 17, 2014 at 1:58 PM,  wrote: > I tried: pip 
install "E:\Portable Python > 2.7.5.1\binwalk-1.3.0\src\setup.py" > > Error: > 
> E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 22:53:51 > > 
Exception: > Traceback (most recent call last): > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\basecommand.py", line 122, in main > status = 
self.run(options, args) > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\commands\install.py", line 257, in run > 
InstallRequirement.from_line(name, None)) > File "E:\Portable Python 
2.7.5.1\App\lib\site-packages\pip\req.py", line > 172, in from_line > return 
cls(req, comes_from, url=url, prereleases=prereleases) > File "E:\Portable 
Python 2.7.5.1\App\lib\site-packages\pip\req.py", line > 70, in __init__ > req 
= pkg_resources.Requirement.parse(req) > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in > 
parse > reqs = list(parse_requirements(
 s)) > File "E:\Portable Python > 
2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in > 
parse_requirements > line, p, specs = 
scan_list(VERSION,LINE_END,line,p,(1,2),"version spec") > File "E:\Portable 
Python > 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py", line 
2512, in > scan_list > raise ValueError("Expected "+item_name+" 
in",line,"at",line[p:]) > ValueError: ('Expected version spec in', 
'E:\\Portable Python > 2.7.5.1\\binwalk-1.3.0\\src\\setup.py', 'at', 
':\\Portable Python > 2.7.5.1\\binwalk-1.3.0\\src\\setup.py') > > > 
-- I'm no expert, but when I try to run pip install ... it seems to 
want a directory that contains a setup.py file rather than the path of the 
setup.py file itself. Try: pip install "E:\Portable Python 
2.7.5.1\binwalk-1.3.0\src" perhaps? -Peter Mawhorter
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing ssdeep on Portable Python

2014-03-20 Thread laguna-mc
Portable Python 2.7 for Windows, the Python application have dependency on 
ssdeep-2.10, which is a binary exe.

The ssdeep (libfuzzy) installation example was shown for Linux platform only:

a) libfuzzy can be installed via apt-get:

    $ sudo apt-get install libfuzzy2

b) to install libfuzzy from source, download the gzipped tarball from 
http://ssdeep.sourceforge.net/#download, then run:

    $ tar -zxvf ssdeep-2.10.tar.gz
    $ cd ssdeep-2.10 && ./configure && make && sudo make install
-
I need install it on PortablePython for Windows, so it's not clear how to make 
this: where should be placed ssdeep Windows binary files, that Python 
application can found it?
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing ssdeep on Portable Python /advice

2014-03-20 Thread laguna-mc
Portable Python 2.7 for Windows, the Python application have dependency on 
ssdeep-2.10, which is a binary exe.

The ssdeep (libfuzzy) installation example was shown for Linux platform only:

a) libfuzzy can be installed via apt-get:

    $ sudo apt-get install libfuzzy2

b) to install libfuzzy from source, download the gzipped tarball from 
http://ssdeep.sourceforge.net/#download, then run:

    $ tar -zxvf ssdeep-2.10.tar.gz
    $ cd ssdeep-2.10 && ./configure && make && sudo make install
-
I need install it on PortablePython for Windows, so it's not clear how to make 
this: where should be placed ssdeep Windows binary files, that Python 
application can found it?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing ssdeep on Portable Python /advice

2014-03-22 Thread laguna-mc
http://ssdeep.sourceforge.net/usage.html

the installation described in aboved document is for Linux only.
Well, I need experiment and see errors.

Regards,


> - Original Message -
> From: Mark H Harris
> Sent: 03/22/14 05:32 AM
> To: python-list@python.org
> Subject: Re: Installing ssdeep on Portable Python /advice
> 
> On 3/21/14 9:51 PM, Mark H Harris wrote:
> > On 3/20/14 7:16 PM, laguna...@mail.com wrote:
> 
> >> $ tar -zxvf ssdeep-2.10.tar.gz
> >> $ cd ssdeep-2.10&& ./configure&& make&& sudo make install
> 
> >> I need install it on PortablePython for Windows, so it's not
> >> clear how to make this: where should be placed ssdeep Windows
> >> binary files, that Python application can found it?
> 
> > It is strongly recommended that ssdeep be run on windows from
> > precompiled binaries. Building from sources is not recommended because
> > of dependencies and environment...
> 
> > Google is our frined;
> 
> > http://ssdeep.sourceforge.net/usage.html
> 
> 
> Actually, I restated that wrong. The doc says that building from sources 
> on windows is NOT supported.
> 
> marcus
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Unpacking U-Boot image file

2014-04-09 Thread laguna-mc
I know about Binwalk, it can run on Linux OS only. I am looking for Python 
script that can run on Windows too.

Thank you.
- Original Message -
From: Adnan Sadzak
Sent: 04/09/14 11:37 PM
To: trewio
Subject: Re: Unpacking U-Boot image file

Oh then see Craig's page [0]. You can find in deepth explanation about some 
tools (Linux) that is used to desompress and mount filesystems/images. From my 
experience you should find first read modem tehnical documentation. Find out 
what kind of firmware is using. You won't find just script to decompress those 
images.

[0] 
http://www.devttys0.com/2011/05/reverse-engineering-firmware-linksys-wag120n/ 

Cheers

On Wed, Apr 9, 2014 at 7:53 PM, trewio < laguna...@mail.com > wrote:U-Boot 
format: hmm, I'm not sure, can someone specify Python script that will help me 
deterermine U-boot format used? [for Python for Windows OS]

Note: I need Python script for Python under Windows OS.

> - Original Message -
> From: Rustom Mody
> Sent: 04/09/14 08:18 PM
> To:  python-list@python.org 
> Subject: Re: Unpacking U-Boot image file
>

> On Wednesday, April 9, 2014 9:36:40 PM UTC+5:30, trewio wrote:
> > How to extract files from U-Boot image file, LZMA-compressed?
> >
> > Is there a Python script that can do this properly?
>
> For lzma theres this (recent) python library
> https://docs.python.org/dev/library/lzma.html 
>
> Though you might just be better off with the command-line xz unxz etc
>
> After that.. whats the U-boot format?
> --
> https://mail.python.org/mailman/listinfo/python-list 

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


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Jeremy Sanders <[EMAIL PROTECTED]> wrote:

> It must be the debugging, the compiler or a poor STL implementation. With
> gcc 4 it runs instantly on my computer (using -O2), even with 10x the
> number of values.

$ gcc --version
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
5363)

I adapted original poster's code and made a function that did not create
strings each time. The NoisyString is a class we can use to actually
track copying.

In fact Python here is faster. Suppose it has a really optimized set
class...


Here some results (I know that the fpoint optimizations are useless...
it's is my "prebuilt" full optimization macro :) ):




$ g++ -O3 -pipe -O2 -march=pentium-m -msse3 -fomit-frame-pointer
-mfpmath=sse  -o set_impl set_impl.cpp 
$ ./set_impl 
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 5.8
Elapsed 1.71

$ g++ -Os -pipe -O2 -march=pentium-m -msse3 -fomit-frame-pointer
-mfpmath=sse  -o set_impl set_impl.cpp 
$ ./set_impl 

What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 5.8
Elapsed 1.71

$ g++ -O3 -o set_impl set_impl.cpp 
$ ./set_impl 
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 0.47
Elapsed 0.18

$ g++ -o set_impl set_impl.cpp 
$ ./set_impl 
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 0.63
Elapsed 0.33

$ python -O set_impl.py 
so long...
What do you know
fool
chicken crosses road
so long...
What do you know
fool
chicken crosses road
Elapsed: 1.37 seconds
Elapsed: 3.81 seconds



--- PYTHON CODE -
#python

global size 
size = 100

def f():
a = []
for i in range(size):
a.append('What do you know')
a.append('so long...')
a.append('chicken crosses road')
a.append('fool')
b = set(a)
for s in b:
print s

def slow_f():
a = []
for i in range(size):
a.append('%s' % 'What do you know')
a.append('%s' % 'so long...')
a.append('%s' % 'chicken crosses road')
a.append('%s' % 'fool')
b = set(a)
for s in b:
print s

import time
from time import clock

f_start = clock()
f()
f_end   = clock()

slow_f_start = clock()
slow_f()
slow_f_end   = clock()

print "Elapsed: %f seconds" % (f_end - f_start)
print "Elapsed: %f seconds" % (slow_f_end - slow_f_start)

--


- CPP CODE -
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;


#define SIZE 100

class NoisyString : public std::string {
  public:
  NoisyString(const string& cp) 
  : string(cp) 
  {
  cout << "Fuck I got copied!" << endl;
  }
  
  NoisyString(const char* s ) : string(s) {

  }
  
  
  
};


void f(){
  vector a;
for (long int i=0; i b(a.begin(), a.end());
copy(b.begin(), b.end(), ostream_iterator(cout, "\n"));
}

void fast_f(){
  vector a;
  string s1  =  "What do you know?"   ;
  string s2  =  "so long..."  ;
  string s3  =  "chicken crosses road";
  string s4  =  "fool";
for (long int i=0; i b(a.begin(), a.end());
copy(b.begin(), b.end(), ostream_iterator(cout, "\n"));
}


int main(){
  clock_t f_start, 
  f_end,
  faster_f_start, 
  faster_f_end,
  fast_f_start,
  fast_f_end;
 
  f_start = clock();
  f();
  f_end   = clock();
  
  fast_f_start = clock();
  fast_f();
  fast_f_end   = clock();
  

  cout << "Elapsed " << (f_end - f_start) / double(CLOCKS_PER_SEC) <<
endl;
  cout << "Elapsed " << (fast_f_end - fast_f_start) /
double(CLOCKS_PER_SEC) << endl;
  
}

---




-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:

> I'm curious though, if on the OP's machine the slowed-down Python
> version is still faster than the C++ version.

I tested both on my machine (my other post in the thread)

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Fredrik Lundh <[EMAIL PROTECTED]> wrote:

> Python's memory allocator is also quite fast, compared to most generic
> allocators...

In fact also in the two "slow" versions Python outperforms C++.
I didn't notice it in the first place.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:


> But your C++ program outputs times in seconds, right? So all
> compilations except for the first two give results in less than a
> second, right? (meaning the optimizations of your standard-compilation
> give worst results than -O3?)

Yes. It's in seconds but the benchmark that are one order of magnitudo
less than the others have of a different "size" (10 instead of
100).  That is cut and paste from my terminal... I think it's a
mess. I do it all again from scratch.

> BTW, I don't quite understand your gcc optimizations for the first 2
> compiles anyways: two -O options with different values. Doesn't that
> mean the 2nd -O takes preference, and the compilation is at -O2 instead
> of -O3?
> Why both -O3 and -O2 at the command-line?

I forgot I put -O2 in my $FAST_FLAGS. I don't know what I was thinking
about.

This the correct version

$ g++ -Os -pipe -march=pentium-m -msse3 -fomit-frame-pointer
-mfpmath=sse  -o set_impl set_impl.cpp 

$ ./set_impl 
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 6.3
Elapsed 2.1

$ g++ -O2 -pipe -march=pentium-m -msse3 -fomit-frame-pointer
-mfpmath=sse  -o set_impl set_impl.cpp 
$ ./set_impl 
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 5.8
Elapsed 1.7

$ g++ -O3 -pipe -march=pentium-m -msse3 -fomit-frame-pointer
-mfpmath=sse  -o set_impl set_impl.cpp 
$ ./set_impl  
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 5.79
Elapsed 1.72

$ g++ -pipe -march=pentium-m -msse3 -fomit-frame-pointer -mfpmath=sse
-o set_impl set_impl.cpp 
$ ./set_impl
What do you know?
chicken crosses road
fool
so long...
What do you know?
chicken crosses road
fool
so long...
Elapsed 7.12
Elapsed 2.98

$ python -O set_impl.py 
so long...
What do you know
fool
chicken crosses road
so long...
What do you know
fool
chicken crosses road
Elapsed: 1.37 seconds
Elapsed: 3.80 seconds

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:

> Oh boy; yes indeed the slow python is faster than the fast C++
> version... Must be something really awful happening in the STL
> implementation that comes with GCC 3.4!

And the Python version does the very same number of iterations than the
C++ one? I suppose they are looping on arrays of different sizes, just
like my "first version".

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:

> NB: Your code now tests for address-equality. Does it also still test
> for string-equality? It looks to me that it does, but it's not quite
> clear to me.

It does it.

set b(a.begin(), a.end());
set c; // well ordered set (b is ordered by address)
for (set::iterator it=b.begin(); it!=b.end(); it++)
c.insert(**it);
copy(c.begin(), c.end(), ostream_iterator(cout, "\n"));

When we populate the first set, we get rid of all strings with same
object id/address (it test equality of pointers). Then we populate
another set (and the default equality test is on strings).

However, I would have written the code using a proper compare function
rather than using two sets. In this particular case the number of
elements of the first set is negligible in respect of the initial vector
size, thus copying it again does not take a lot of time.
But such code is optimized for the problem itself: in the real world I
suppose we would have passed set a proper comparison function that
checks address and then string equality.


-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:

> My conclusion from that is, that the vector<> or set<> implementations
> of GCC are far superior to those of VC++ 6, but that memory allocation
> for GCC 3.4.5 (MinGW version) is far worse than that of MSCRT / VC++ 6.
> (And Python still smokes them both).

It would be interesting to test it with VC 8 (2005). I have it in my
Parallels vm, but it looks like something is wrong. The very same code
takes almost a minute, I suppose there is something wrong with it
(Python is almost as fast as the python 2.4 on MacOS).



-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:

> And the results of IronPython (1.0rc2) are just in as well:

I can't test this one.

>
> And for Python 2.5:
> [EMAIL PROTECTED] ~/My Documents/Python
> $ /cygdrive/c/Python25/python.exe SpeedTest.py
> Begin Test
> Number of unique string objects: 4
> so long...
> What do you know
> fool
> chicken crosses road
> Number of unique string objects: 40
> so long...
> What do you know
> fool
> chicken crosses road
> Fast - Elapsed: 0.440619 seconds
> Slow - Elapsed: 1.095341 seconds


What the heck... you have a Cray, haven't you?
$ /opt/misc/bin/python2.5 -O set_impl.py 
so long...
What do you know
fool
chicken crosses road
so long...
What do you know
fool
chicken crosses road
Elapsed: 1.30 seconds
Elapsed: 1.29 seconds

Yes... good optimizer work. The 'slow' code here is faster than the fast
one.


$ python -O set_impl.py 
so long...
What do you know
fool
chicken crosses road
so long...
What do you know
fool
chicken crosses road
Elapsed: 1.36 seconds
Elapsed: 3.80 seconds

> (Next step would be to create a VB version and a Java version of the
> same program, oh and perhaps to try a version that would work with
> Jython... perhaps somehow w/o the 'set')

Ok. I can do the Java version. If I find a RealBasic Set class I can do
it. However, I don't remember anything about VB6, and have done nothing
with .Net.
But I don't think it is that interesting. Java strings are immutable
too: I expect it to outperform Python (unless Java Set class sucks). And
I don't see the point of taking in VB.
A good BASIC implentation is comparable with Pascal or C++ speedwise.
(At least this results from Great Language Shootout and Free Basic). 

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote:

> I'm using VC++ Express, I didn't care to tweak the optimizations, I
> merely chose the "Release" configuration for the executable. It's
> blazing fast, taking only 30+ ms each run.

Of course it is faster. We are looping 100 times, you just 1.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote:

> Not really, see my test, in my other post in the same thread. I'm using
> VC++ Express 2005. If we're comparing with Python 2.5 I think it's just
> fair that for C++ we're using the latest as well.

In your test, you are looping 1 times, we looped 100.
In Python tests with 1 elements, it was about 10 ms.

Moreover, we tried various Python and C++ configurations. Most of the
tests are done with Python 2.4, not 2.5.
And I used gcc4, that is to say the latest on my platform.
 
> Same here, although that said Python's implementation of those data
> structure must already be as optimal as mortals can do it. 

I think this is the rationale behind it.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
<[EMAIL PROTECTED]> wrote:

> That's to say,
> python is still much faster?

Yes it is. But of course you can't sat that "Python is faster than C++".
We found that the code to do this, written in the most natural way, is a
lot faster in Python. However, if you optimze the code, C++ gets almost
as fast.

In other benchmarks C++ outperforms Python and is 10 or 100 times
faster.


> Maybe someone can post this to the c++ maillist and they will tell how
> to accelerate it.

There are enough C++ experts here to do it. The point is another.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote:

> Certainly--I was not comparing 100 against 1. Referring to the
> OP's statement: "However, while the python code gave the result almost
> instantly, the C++ code took several seconds to run!" 30ms sounds like
> a definite improvement over several seconds!

Of course. I suppose there's something broken in OP's C++ setup (in fact
the version I compiled with VCPP 2005 also takes a lot of seconds...
something like 20-30 seconds, but of course this makes me think I
haven't understood how it is supposed to work, since my gcc gives
results comparable to yours).

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
GHUM <[EMAIL PROTECTED]> wrote:

> Proofed @ EuroPython
> 2006 in CERN, near the LHC Beta, in the same room many Nobel laurates
> gave their presentations before.

Have you some link? I suppose it's kind of a joke they did or something
like that...

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote:

> Yeah, my guess would be either he used the Debug configuration or he
> actually created a Managed executable instead of a pure Win32
> application. Sigh, now I can't wait to get home and try it out :)

Can be. But I suppose a Managed should not get *that* slow. 
IronPython on Tim's machine is still faster than C++ (even though not as
fast as CPython).

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote:

> I have to admit to a stupid mistake, for which I feel quite ashamed - I
> got the loop-size wrong in the Python code. So all Python results
> posted by me were off by a factor of 10 :-(
> I feel quite bad about that!

Well, this makes *my* results quite surprising.
I checked it threetimes. I loop 100 times in both Python and C++,
and Python here is faster.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote:

> Great to know that my model of how the world works is still correct!
> (at least in relation to Python and C++!) :)

So please explain my results. I loop the same number of times.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-24 Thread Mc Osten
Neil Cerutti <[EMAIL PROTECTED]> wrote:

> Those of you experiencing a temporary obsession with this topic
> are encouraged to study The Great Language Shootout, until the
> obsession goes away. ;)

I think that everybody knows GLS. However, when I have results different
from what I expected, I try to understand where I did the wrong
assumption.

However, a recent post kind of explains what the problem is.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-24 Thread Mc Osten
Neil Cerutti <[EMAIL PROTECTED]> wrote:

> Those of you experiencing a temporary obsession with this topic
> are encouraged to study The Great Language Shootout, until the
> obsession goes away. ;)

I think that everybody knows GLS. However, when I have results different
from what I expected, I try to understand where I did the wrong
assumption.

But a recent post kind of explains what the problem is.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running Python script from C++ code(.NET)

2006-09-24 Thread Mc Osten
volcano <[EMAIL PROTECTED]> wrote:

> A trivial question - I have a working Python script that I have to
> invoke from C++ code. No fancy stuff - just run the whole script with
> its parameters. No callbacks, no signalling - nada, just
> stupid,primitive, straightforward call.

 In a unix based environment I would use fork + exec*. IIRC in Windows
you should have a CreateProcess function call.




You could also try system, but it's generally considered insecure.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a Zen language?

2006-02-28 Thread Mc Osten
On 26 Feb 2006 14:55:04 -0800, Andrea Griffini wrote:

> IMO another language that would be hard to classify is COBOL ... but
> for other reasons :-)

According to Dijkstra:

"The use of COBOL cripples the mind; its teaching should, therefore, be
regarded as a criminal offence." 

That makes Cobol a Zen language (since it not only changes, but also
cripples the mind).

And BASIC too:
"It is practically impossible to teach good programming to students that
have had a prior exposure to BASIC: as potential programmers they are
mentally mutilated beyond hope of regeneration."

-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Mc Osten
On 1 Mar 2006 11:32:02 -0800, Derek Basch wrote:

> This one has always bugged me. Is it better to just slap a "self" in
> front of any variable that will be used by more than one class method
> or should I pass around variable between the methods?

I think there is no clear "general" answer. A criterion could be that
instance variables should be those who define the state of the object, that
define its "meaning".

About the others to me it's a matter of taste.

-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Path completion in 'raw-input'?

2006-03-01 Thread Mc Osten
On Wed, 01 Mar 2006 10:00:43 -0800, Johannes Graumann wrote:

> There's also the rlcompleter module, but in the interest of better platform
> agnosis I'd like to stick with cmd ...

I would have suggested readline..

This works on Windows:


This about readline on MacOS:


[ you don't need if you use Python 2.4 from undefined.org
 ]



-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Threading - will threads run in parallel?

2006-03-01 Thread Mc Osten
On 28 Feb 2006 11:20:05 -0800, SolaFide wrote:

> (get() is a function which waits for a ping on a specific port, thus
> stopping the program for a while.)

It's a busy wait?

-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sockets, where can I find documentation?

2006-03-03 Thread Mc Osten
On Fri, 03 Mar 2006 11:41:05 GMT, John Pote wrote:

> Where can I get the various papers mentioned in the manual? And as I like 
> books sitting on the shelf can someone recommend a book on sockets.

Unix Network Programming by Stevens

-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how do you move to a new line in your text editor?

2006-03-03 Thread Mc Osten
On Thu, 02 Mar 2006 18:58:50 GMT, John Salerno wrote:

> I use UltraEdit right now, and it is possible to convert spaces and tabs 
> back and forth, but it's just an extra step.

I wouldn't definitely suggest UltraEdit to code Python.
Probably you should try scite. 

 I'm using TextMate (but it's MacOS only). When on Linux I use Emacs or vim
(depends on what I find on the machine). On Windows I prefer gvim to Emacs,
since I've not yet found a well integrated Emacs distribution (I said I
did't find it, not that it doesn't exist).


-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how do you move to a new line in your text editor?

2006-03-03 Thread Mc Osten
On Fri, 03 Mar 2006 16:48:11 GMT, John Salerno wrote:

> Why do you say that?

Because I tried it and it just lacks a lot of functionality you get with
TextMate or Emacs. It is quite stupid when indenting, just to name one.

-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


Writing event handler for dropdown list in python

2007-11-23 Thread mc . pandey
Hi,

I am new to python,
Can someone help me with writing event handler for a dropdown list in
python.


i have one function to create dropdown list in a file


def dropdown_options(self,title,options,name,value = None):
ret = "\n"+ title.title() + "
\n"
if (options != []):
ret += "\n"
for i in options:
if (value != None and str(value) == str(i[0])):
ret += ""+str(i[1])+"\n"
else:
ret += ""+str(i[1])+"\n"
ret += ""
else:
ret += "No options available for this item"
return ret


and i am calling this from another file


ret += ui.dropdown_options("Project",db.getprojects(user),"proj") +
ui.linebreak()


Now i want to do some activity when i select diffrent options from
the
dropdown list.


Any help is appreciated !!


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


how to write event handler for dropdown list

2007-11-23 Thread mc . pandey
Hi,

I am new to python,
Can someone help me with writing event handler for a dropdown list in
python.

i have one function to create dropdown list in a file

def dropdown_options(self,title,options,name,value = None):
ret = "\n"+ title.title() + "
\n"
if (options != []):
ret += "\n"
for i in options:
if (value != None and str(value) == str(i[0])):
ret += ""+str(i[1])+"\n"
else:
ret += ""+str(i[1])+"\n"
ret += ""
else:
ret += "No options available for this item"
return ret

and i am calling this from another file

ret += ui.dropdown_options("Project",db.getprojects(user),"proj") +
ui.linebreak()

Now i want to do some activity when i select diffrent options from the
dropdown list.

Any help is appreciated !!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simulation Programming Skills and Python

2006-03-07 Thread Mc Osten
On Mon, 06 Mar 2006 10:48:46 -0500, Richard Blackwood wrote:

> Two, is 
> Python a good language for simulation programming?

Civilization 4 is (partly) written in Python. I suppose they thought Python
was a good language for that. I said partly because as far as I know some
code is C++ for speed reasons.

-- 
USB Priests for only 10$
-- 
http://mail.python.org/mailman/listinfo/python-list


python simplejson decoding

2011-03-02 Thread Arthur Mc Coy
Hi all,



I'm trying an example (in attached file, I mean the bottom of this
message).

First, I create a list of 3 objects. Then I do:


PutJSONObjects(objects)
objects = GetJSONObjects()
PutJSONObjects(objects, "objects2.json")


1) PutJSONObjects(objects) method creates objects.json file (by
default). It works fine.
2) Then objects = GetJSONObjects() method get the file contents and
return.

3) Finally the script fails on the third method
PutJSONObjects(objects, "objects2.json")
saying: AttributeError: 'dict' object has no attribute '__dict__'


That is true, because objects returned by GetJSONObjects() is not a
list of objects, but simple string

So here is the question, please, how should I DECODE .json file into
list of python objects so that I will be able to put the copy of these
objects into a new file called objects2.json ?

simplejson docs are hard to follow - without examples.



Please, help me. Be happy!

Arthur



# Python-JSON method for caching my objects.

import simplejson as json
import os.path
from datetime import datetime


def GetJSONObjects():

# determine the json data file path
filename = "objects.json"
filepath = "/home/docmccoy/Documents/" + filename
if os.path.isfile(filepath):
filename = filepath
f = open(filename, 'r')
objects = json.load( f )
print objects
else:
objects = list()

return objects


def PutJSONObjects(objects, filename = "objects.json"):

# determine the json data file path
filepath = "/home/docmccoy/Documents/" + filename
if os.path.isfile(filepath):
filename = filepath

f = open(filename, 'w')
json.dump([o.__dict__ for o in objects], f, indent = 4 * ' ' )


class MyObject:
def __init__(self, ID, url, category, osfamily, createDate):
self.id = ID
self.url = url
self.category = category
self.osfamily = osfamily
self.createDate = createDate


o1 = MyObject(1, "http://google.com";, "search", "linux",
unicode(datetime.now()))
o2 = MyObject(2, "http://localhost";, "mycomp", None,
unicode(datetime.now()))
o3 = MyObject(3, "http://milan.com";, "football", "windows",
unicode(datetime.now()))

objects = list()
objects.append(o1)
objects.append(o2)
objects.append(o3)

PutJSONObjects(objects)
objects = GetJSONObjects()
PutJSONObjects(objects, "objects2.json")
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
What do you mean by "arbitrary precision" ? Each method of calculating
of something has its own precision...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
On Mar 2, 5:26 pm, Ben123  wrote:
> On Mar 2, 9:04 am, Arthur Mc Coy <1984docmc...@gmail.com> wrote:
>
> > What do you mean by "arbitrary precision" ? Each method of calculating
> > of something has its own precision...
>
> If you are unfamiliar with arbitrary precision, I'm referring 
> tohttp://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
>
> Suppose I find the eigenvalues of a matrix and the eigenvalues range
> from 1 to 0.0001. This can be handled by numpy in Python because the
> smallest eigenvalue is larger than then numerical precision of 1E-19.
> However, if the range of eigenvalues is 1 to 1E-40, then I will need
> to increase the precision of all calculations leading up to finding
> the eigenvalues.
>
> I am working with complex valued matrices and I expect to get real
> eigenvalues back (based on the physics of the system). The precision
> of numpy is apparent from the imaginary component of the eigenvalues I
> find, currently 1E-19 or 1E-20. I need better precision for small
> eigenvalues.
>
> In case you are curious, the complex-valued matrices are 20x20.
>
> Thanks

You probably have to change the method of finding eigenvalues.
Which one do you use? Power or algebraic ?
Do you use Gaussian method to simplify matrices ?

Languages can't support infinitely large or small numbers, so try to
multiply the inner variables by 10^n to increase their values if this
will not involve on the method. For example, I did this when was
calculating geometric means of computer benchmarks.
In such way you will be storing the number of zeros as n.

Yes, interesting what are you calculating.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python simplejson decoding

2011-03-02 Thread Arthur Mc Coy
Hi Peter,


I implemented my decoder using your approach. Very positive.

But that is for simple objects. My objects have nested lists. For
example MyObject has property (member) called benchmarks, which is the
list of defined benchmarks. I'm not sure if obj.__dict__.update will
help me to copy nested information. I will see later. Now, when the
testing environment is ready, I go for real world application.


Thank you!

Kostia

On Mar 2, 4:24 pm, Peter Otten <__pete...@web.de> wrote:
> Arthur Mc Coy wrote:
> > Hi all,
>
> > I'm trying an example (in attached file, I mean the bottom of this
> > message).
>
> > First, I create a list of 3 objects. Then I do:
>
> > PutJSONObjects(objects)
> > objects = GetJSONObjects()
> > PutJSONObjects(objects, "objects2.json")
>
> > 1) PutJSONObjects(objects) method creates objects.json file (by
> > default). It works fine.
> > 2) Then objects = GetJSONObjects() method get the file contents and
> > return.
>
> > 3) Finally the script fails on the third method
> > PutJSONObjects(objects, "objects2.json")
> > saying: AttributeError: 'dict' object has no attribute '__dict__'
>
> > That is true, because objects returned by GetJSONObjects() is not a
> > list of objects, but simple string
>
> > So here is the question, please, how should I DECODE .json file into
> > list of python objects so that I will be able to put the copy of these
> > objects into a new file called objects2.json ?
>
> > simplejson docs are hard to follow - without examples.
>
> I suggest that you use json instead which is part of the standard library
> since Python 2.6. The documentation is here:
>
> http://docs.python.org/library/json.html
>
> If you know that there are only MyObject instances you need a function to
> construct such a MyObject instance from a dictionary. You can then recreate
> the objects with
>
> objects = [object_from_dict(d) for d in json.load(f)]
>
> or, if all dictionaries correspond to MyObject instances
>
> objects = json.load(f, object_hook=object_from_dict)
>
> A general implementation for old-style objects (objects that don't derive
> from object) is a bit messy:
>
> # idea copied from pickle.py
> class Empty:
>     pass
>
> def object_from_dict(d):
>     obj = Empty()
>     obj.__class__ = MyObject
>     obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
>     return obj
>
> If you are willing to make MyClass a newstyle class with
>
> class MyObject(object):
>     # ...
>
> the function can be simplified to
>
> def object_from_dict(d):
>     obj = object.__new__(MyObject)
>     obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
>     return obj
>
> (*) I don't know if unicode attribute names can do any harm,
> obj.__dict__.update(d) might work as well.

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


Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
> Are you saying python cares whether I express a number as 0.001 or
> scaled by 10^5 to read 100? If this is the case, I'm still stuck. I
> need the full range of eigenvalues from 1 to 1E-300, so the entire
> range could be scaled by 1E300 but I would still need better precision
> than 1E19

If python package can't compute 1E-300, then you can't use it.
You can try to split your task onto small subtasks, which can be
handled by specific python package.

Then you need to think of the way to do that. Mathematically. If no
way, then you can leave your task alone.
Programming is limiting, that is true.

I have heard about grid computing. You may find scientists working on
grid and ask how do they split their tasks.
But I think they do not an answer as well.

Also google uses its matrix to rank web pages. It computes the maximum
eigenvalue from the matrix which contain near zero entries too. Maybe
you can find how do they store those values.

Sorry, can't help anymore. I also have computing problems which I
can't yet solve :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python simplejson decoding

2011-03-04 Thread Arthur Mc Coy
Good day people,


So I have python file which can handle json data to put and get back
it from a file say objects.json. Great.

Now I want to run this code from within C++ application. I used swig
to wrap the C++ class, which wants to call python code. It works fine,
because when I import native python modules like simplejson or os.path
the operation is successfull.

But how to import my custom python code (not native builtin modules) ?
There are following ways:
- import as python module
- call python file and its functions

I prefer second way because I do not know how to define my custom
module.

If you know some examples, let me know please. Yes, I'm googling and
reading off docs, but have not yet understood them.


Arthur
-- 
http://mail.python.org/mailman/listinfo/python-list


import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
Hi all,


I have a C++ application. I have a .cpp file which is not a main
program, but a class where I want to call python script
(doSomething.py file).

I'm using embed python like in a tutorial here:
http://www.codeproject.com/KB/cpp/embedpython_1.aspx

But the tutorial is bad. It does not explain howto create python
module which they call in their example. doSomething.py file contains
two classes, one of them I use externally (its functions).

So I need to PyImport_Import(py_module) by name of this py file, but
when I try to do that it fails. Please, give me some examples.


If needed, I can attach my code as well.
Thank you, waiting for anybody's response!
Be happy.

Arthur
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
Yes, I did. Here the link
http://docs.python.org/extending/extending.html#providing-a-c-api-for-an-extension-module

It does not cover .py file embeding. So it is not my case.

On Fri, Mar 4, 2011 at 7:03 PM, Santoso Wijaya wrote:

> Have you read the doc [1] on extending/embedding Python?
>
> ~/santa
>
> [1] http://docs.python.org/extending/
>
> On Fri, Mar 4, 2011 at 8:27 AM, Arthur Mc Coy <1984docmc...@gmail.com>wrote:
>
>> Hi all,
>>
>>
>> I have a C++ application. I have a .cpp file which is not a main
>> program, but a class where I want to call python script
>> (doSomething.py file).
>>
>> I'm using embed python like in a tutorial here:
>> http://www.codeproject.com/KB/cpp/embedpython_1.aspx
>>
>> But the tutorial is bad. It does not explain howto create python
>> module which they call in their example. doSomething.py file contains
>> two classes, one of them I use externally (its functions).
>>
>> So I need to PyImport_Import(py_module) by name of this py file, but
>> when I try to do that it fails. Please, give me some examples.
>>
>>
>> If needed, I can attach my code as well.
>> Thank you, waiting for anybody's response!
>> Be happy.
>>
>> Arthur
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
The problem is "how to write python module under SWIG for C++
application"

Nor SWIG documentation neither embeding python documentation does not
answer to this.


If you can help, please, share your idea.

Arthur
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
Using simple words: I have mymodule.py file and c++ application.
mymodule.py file contains two classes A and B. A class is a custom data
type. B class contains functions putJSON, getJSON which I want to run from
within C++ code. These functions are members of class B. So I need to import
mymodule.py inside C++ app and call its members.

Documentation does not explain this or it is written in a way that hard to
catch out.

I guess SWIG can help me to create a python module interface, but I can't do
that since SWIG documentation is also poor in my case.

Thank you for any help

Arthur
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >