Re: are int, float, long, double, side-effects of computer engineering?

2012-03-13 Thread John Nagle

On 3/7/2012 2:02 PM, Russ P. wrote:

On Mar 6, 7:25 pm, rusi  wrote:

On Mar 6, 6:11 am, Xah Lee  wrote:



I might add that Mathematica is designed mainly for symbolic
computation, whereas IEEE floating point numbers are intended for
numerical computation. Those are two very different endeavors. I
played with Mathematica a bit several years ago, and I know it can do
numerical computation too. I wonder if it resorts to IEEE floating
point numbers when it does.


   Mathematica has, for some computations, algorithms to determine the
precision of results.  This is different than trying to do infinite
precision arithmetic, which doesn't help as soon as you get to trig
functions.  It's about bounding the error.

   It's possible to do bounded arithmetic, where you carry along an
upper and lower bound on each number.  The problem is what to do
about comparisons.  Comparisons between bounded numbers are
ambiguous when the ranges overlap.  Algorithms have to be designed
to deal with that.  Mathematica has such algorithms for some
operations, especially numerical integration.

   It's a very real issue. I had to deal with this when I was
writing the first "ragdoll physics" system that worked right,
back in the 1990s.  Everybody else's system blew up on the hard
cases; mine just slowed down.  Correct integration over a force
function that's changing over 18 orders of magnitude is difficult,
but quite possible.

(Here it is, from 1997: "http://www.youtube.com/watch?v=5lHqEwk7YHs";)
(A test with a heavy object:
"http://www.youtube.com/watch?v=-DaWIHc1VLY";.  Most physics engines
don't do heavy objects well. Everything looks too light. We call
this the "boink problem.")

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


Re: Python-list Digest, Vol 102, Issue 64

2012-03-13 Thread David Shi
I am looking very simple and straightforward open source Python REST and SOAP 
demo modules.

I really need things which are very simple and convincing.   I want to 
demonstrate these to other people.

I want to promote you guys' interest.   I find asp and others frustrating and 
occupy too much in the market and popularity.

Can we do a new tidal wave to win a reasonable portion of the development 
market?

Send me materials to davidg...@yahoo.co.uk

I will give it a go on behalf of the Python community.

Regards.

David



 From: "python-list-requ...@python.org" 
To: python-list@python.org 
Sent: Tuesday, 13 March 2012, 20:35
Subject: Python-list Digest, Vol 102, Issue 64
 
- Forwarded Message -

Send Python-list mailing list submissions to
    python-list@python.org

To subscribe or unsubscribe via the World Wide Web, visit
    http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body 'help' to
    python-list-requ...@python.org

You can reach the person managing the list at
    python-list-ow...@python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Python-list digest..."

Today's Topics:

   1. Re: concatenate function (James Elford)
   2. Re: New Science Discovery: Perl Idiots Remain Idiots After A
      Decade!New    Science Discovery: Perl Idiots Remain Idiots After A
      Decade! (Kiuhnm)
   3. Re: Installing Python Apps on  Mac Lion
      (dilvanezanard...@gmail.com)
   4. Re: Software Engineer - (Pedro H. G. Souto)
   5. Re: Software Engineer - (Neil Cerutti)
   6. RE: Windows Contextmenu (Prasad, Ramit)
   7. Re: concatenate function (ferreirafm)
   8. Re: Installing Python Apps on Mac Lion (Benjamin Kaplan)
   9. Re: Windows Contextmenu (Terry Reedy)
  10. Re: concatenate function (Robert Kern)
On 13/03/12 16:02, ferreirafm wrote:
> Hi James, thank you for your replay. Indeed, the problem is qsub. And as
> warned by Robert, I don't have functions properly, but just scripts.
>  
> 
> --
> View this message in context: 
> http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574511.html
> Sent from the Python - python-list mailing list archive at Nabble.com.

It looks like you're not calling wait() on your subprocesses: you're
effectively launching a bunch of processes, then not waiting for them to
finish before you ask the next process to operate on the same file.

If you haven't given it a good look-over already, the subprocess
documentation [1] is worth taking a little time over.

    [1]: http://docs.python.org/library/subprocess.html#popen-objects

James

On 3/12/2012 20:00, Albert van der Horst wrote:
[...]

Sorry for triple posting. I hadn't noticed the follow up and I was blaming my 
newsserver.
BTW, Python is the next language (right after Perl) I'm going to learn.
Then I'll probably have a look at Ruby...

Kiuhnm

Sábado, 25 de Junho de 2011 02h20min49s UTC+1, JKPeck escreveu:
> The Lion version of the OS on the Mac comes with Python 2.7 installed, but it 
> is in /System/Library/Frameworks/..., and this area is not writable by third 
> party apps.
> 
> So is there a consensus on what apps that typically install under the Python 
> site-packages directory should do in this situation?  Installing Python from 
> python.org puts it in the writable area /Library/Frameworks/Python.framework.
> 
> So, what should a Python app installer do?
> 
> Thanks

Hello,

currently I have:

/Library/Python/2.7/
/Library/Frameworks/Python.framework/Versions/2.7/
/Users/user/Library/Python/2.7/

With 3 folders "site-packages" and do not know why.
What's the difference?

Thanks.


On 2012-03-13 12:44 PM, Paul Rudin wrote:
> Just out of interest why do people object to job adverts here? Seems
> harmless enough...
Wannabe list admins... Or list admins with a need to proof themselves... Or 
none of the above.

On 2012-03-13, Pedro H. G. Souto  wrote:
> On 2012-03-13 12:44 PM, Paul Rudin wrote:
>> Just out of interest why do people object to job adverts here?
>> Seems harmless enough...
>
> Wannabe list admins... Or list admins with a need to proof
> themselves... Or none of the above.

A job listing here or there would fine. If the discussion were
clogged with them, it would be really annoying.

In addition, it's more efficient to post job listing in a place
where people looking for jobs can easily find them, and it's
annoying and useless to post them in a place where reader not
looking for jobs have to delete them.

-- 
Neil Cerutti

> > Now the script runs fine but I don't get all arguments from sys.argv.
> >
> > No mather how many files I mark in the explorer I only get one as an
> > argument.
> 
> You're missing out vital information:
> 
> * How have you attached this code to the context menu? What was
> the exact registry entry (or other method) you used?

From a quick Google search, it seems that most of the context menu
entries open a single file. If multiple file

Re: Adopting ‘lockfile’

2012-03-13 Thread Ben Finney
Chris Withers  writes:

> On 03/03/2012 21:43, Ben Finney wrote:
> > I don't see a need to horse around with Git either :-) It's currently in
> > Subversion, right? Can you not export the VCS history from Google Code's
> > Subversion repository […]

> What's wrong with a "git svn clone svn-url-here" ?

Thanks for the suggestion. I've imported it from Subversion into Bazaar
(my preferred DVCS), and it went smoothly.

I will proceed with a handover from Skip for maintenance of ‘lockfile’.


This will definitely need more people than me to maintain, though! I am
interested and motivated to work on the Linux platform, but other
platforms will suffer unless I get co-maintainers with experience in the
different file locking semantics there.

-- 
 \  “I find the whole business of religion profoundly interesting. |
  `\ But it does mystify me that otherwise intelligent people take |
_o__)it seriously.” —Douglas Adams |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] pyspread 0.2.1

2012-03-13 Thread Martin Manns
==
pyspread 0.2.1
==


Pyspread 0.2.1 is released.

The new version improves GPG integration.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.
Pyspread is designed for Linux and other GTK platforms.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/


What is new in 0.2.1


 * Format menu added
 * Printing bug (first line not printed) fixed
 * GPG key choice dialog added
 * Secret key generation dialog added
 * Password saving in .pyspreadrc is now optional
 * Preferences dialog entries are now validated
 * Toolbar positions are now saved on exit
 * Absolute addressing with mouse changed to  + 
 * Relative addressing with mouse changed to  + 


Enjoy

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


Re: Enchancement suggestion for argparse: intuit type from default

2012-03-13 Thread Ben Finney
r...@panix.com (Roy Smith) writes:

> Using argparse, if I write:
>
> parser.add_argument('--foo', default=100)
>
> it seems like it should be able to intuit that the type of foo should
> be int (i.e. type(default))
[…]

-0.5.

That feels too magical to me. I don't see a need to special-case that
usage. There's not much burden in being explicit for the argument type.

-- 
 \   “Value your freedom or you will lose it, teaches history. |
  `\ “Don't bother us with politics,” respond those who don't want |
_o__)to learn.” —Richard M. Stallman, 2002 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Enchancement suggestion for argparse: intuit type from default

2012-03-13 Thread Roy Smith
Using argparse, if I write:

parser.add_argument('--foo', default=100)

it seems like it should be able to intuit that the type of foo should
be int (i.e. type(default)) without my having to write:

parser.add_argument('--foo', type=int, default=100)

Does this seem like a reasonable enhancement to argparse?


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


Re: Fast file data retrieval?

2012-03-13 Thread Jorgen Grahn
On Mon, 2012-03-12, MRAB wrote:
> On 12/03/2012 19:39, Virgil Stokes wrote:
>> I have a rather large ASCII file that is structured as follows
>>
>> header line
>> 9 nonblank lines with alphanumeric data
>> header line
>> 9 nonblank lines with alphanumeric data
>> ...
>> ...
>> ...
>> header line
>> 9 nonblank lines with alphanumeric data
>> EOF
>>
>> where, a data set contains 10 lines (header + 9 nonblank) and there can
>> be several thousand
>> data sets in a single file. In addition,*each header has a* *unique ID
>> code*.
>>
>> Is there a fast method for the retrieval of a data set from this large
>> file given its ID code?

[Responding here since the original is not available on my server.]

It depends on what you want to do. Access a few of the entries (what
you call data sets) from your program? Process all of them?  How fast
do you need it to be?

> Probably the best solution is to put it into a database. Have a look at
> the sqlite3 module.

Some people like to use databases for everything, others never use
them. I'm in the latter crowd, so to me this sounds as overkill, and
possibly impractical. What if he has to keep the text file around? A
database on disk would mean duplicating the data. A database in memory
would not offer any benefits over a hash.

> Alternatively, you could scan the file, recording the ID and the file
> offset in a dict so that, given an ID, you can seek directly to that
> file position.

Mmapping the file (the mmap module) is another option.
But I wonder if this really would improve things.

"Several thousand" entries is not much these days. If a line is 80
characters, 5000 entries would take ~3MB of memory. The time to move
this from disk to a Python list of 9-tuples of strings would be almost
only disk I/O.

I think he should try to do it the dumb way first: read everything
into memory once.

/Jorgen

-- 
  // Jorgen GrahnO  o   .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread Chris Rebert
On Tue, Mar 13, 2012 at 1:35 PM, Robert Kern  wrote:
> On 3/13/12 6:01 PM, ferreirafm wrote:
>> Robert Kern-2 wrote
>>> When you report a problem, you should copy-and-paste the output that you
>>> got and
>>> also state the output that you expected. I have no idea what you mean
>>> when
>>> you
>>> say "subprocess.Popen seems not accept to run "qsub" over a second
>>> program."
>>>
>>
>> Code goes here:
>> http://ompldr.org/vZDB5YQ
>>
>> stdout:
>> $ no_name.py --toplist top_percent.list
>> Traceback (most recent call last):
>>   File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 73, in
>>     main()
>>   File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 68, in main
>>     comb_slt(toplist)
>>   File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 55, in
>> comb_slt
>>     subprocess.Popen([cmd, options], env=qsub_env)
>>   File "/share/apps/python/lib/python2.7/subprocess.py", line 679, in
>> __init__
>>     errread, errwrite)
>>   File "/share/apps/python/lib/python2.7/subprocess.py", line 1228, in
>> _execute_child
>>     raise child_exception
>> OSError: [Errno 13] Permission denied
>
>
> You need to use a command list like this:
>
> ['qsub', 'combine_silent.linuxgccrelease', '-database',
> '/home6/psloliveira/rosetta_database/', ...]
>
> The program to run ("qsub", not "qsub combine_silent.linuxgccrelease") and
> each individual argument must be a separate string in the list. You cannot
> combine them together with spaces. The reason you get a "Permission denied"
> error is that it tried to find an executable file named "qsub
> combine_silent.linuxgccrelease" and, obviously, could not.

See also the first "Note" box (and the description of "args" generally) under
http://docs.python.org/library/subprocess.html#popen-constructor

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread Robert Kern

On 3/13/12 6:01 PM, ferreirafm wrote:


Robert Kern-2 wrote


When you report a problem, you should copy-and-paste the output that you
got and
also state the output that you expected. I have no idea what you mean when
you
say "subprocess.Popen seems not accept to run "qsub" over a second
program."



Code goes here:
http://ompldr.org/vZDB5YQ

stdout:
$ no_name.py --toplist top_percent.list
Traceback (most recent call last):
   File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 73, in
 main()
   File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 68, in main
 comb_slt(toplist)
   File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 55, in comb_slt
 subprocess.Popen([cmd, options], env=qsub_env)
   File "/share/apps/python/lib/python2.7/subprocess.py", line 679, in
__init__
 errread, errwrite)
   File "/share/apps/python/lib/python2.7/subprocess.py", line 1228, in
_execute_child
 raise child_exception
OSError: [Errno 13] Permission denied


You need to use a command list like this:

['qsub', 'combine_silent.linuxgccrelease', '-database', 
'/home6/psloliveira/rosetta_database/', ...]


The program to run ("qsub", not "qsub combine_silent.linuxgccrelease") and each 
individual argument must be a separate string in the list. You cannot combine 
them together with spaces. The reason you get a "Permission denied" error is 
that it tried to find an executable file named "qsub 
combine_silent.linuxgccrelease" and, obviously, could not.


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: Windows Contextmenu

2012-03-13 Thread Terry Reedy

On 3/13/2012 5:41 AM, Szabo, Patrick (LNG-VIE) wrote:

Hi,

I wrote the following Script which I want to run from the open with
contextmenu in Windows.



Now the script runs fine but I don’t get all arguments from sys.argv.

No mather how many files I mark in the explorer I only get one as an
argument.


The right-click contextmenu is not a command line. It is more like a 
list of no-arg* methods to call on the selected file.


* or rather, one input arg, with others having default values set when 
the menu entry is created. Sometimes a second input arg is handled, at 
least in effect, with a second submenu, but I am not familiar with how 
those are done in Windows.


--
Terry Jan Reedy


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


Re: Installing Python Apps on Mac Lion

2012-03-13 Thread Benjamin Kaplan
On Tue, Mar 13, 2012 at 12:42 PM,  wrote:
>
> Sábado, 25 de Junho de 2011 02h20min49s UTC+1, JKPeck escreveu:
> > The Lion version of the OS on the Mac comes with Python 2.7 installed,
> > but it is in /System/Library/Frameworks/..., and this area is not writable
> > by third party apps.
> >
> > So is there a consensus on what apps that typically install under the
> > Python site-packages directory should do in this situation?  Installing
> > Python from python.org puts it in the writable area
> > /Library/Frameworks/Python.framework.
> >
> > So, what should a Python app installer do?
> >
> > Thanks
>
> Hello,
>
> currently I have:
>
> /Library/Python/2.7/
> /Library/Frameworks/Python.framework/Versions/2.7/
> /Users/user/Library/Python/2.7/
>
> With 3 folders "site-packages" and do not know why.
> What's the difference?
>
> Thanks.
>

If I had to take a guess, having not played too much with Lion:

/Library/Python/2.7 is for user-installed packages for the system
python that are installed for all users.
/Library/Frameworks/... is for the user-installed Python (that's where
it's always gone)
/Users/user/Library... is for user-installed packages for the system
Python that are only installed for the specific user.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread ferreirafm

Robert Kern-2 wrote
> 
> When you report a problem, you should copy-and-paste the output that you
> got and 
> also state the output that you expected. I have no idea what you mean when
> you 
> say "subprocess.Popen seems not accept to run "qsub" over a second
> program."
> 

Code goes here: 
http://ompldr.org/vZDB5YQ

stdout:
$ no_name.py --toplist top_percent.list
Traceback (most recent call last):
  File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 73, in 
main()
  File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 68, in main
comb_slt(toplist)
  File "/home6/psloliveira/ferreirafm/bin/no_name.py", line 55, in comb_slt
subprocess.Popen([cmd, options], env=qsub_env)
  File "/share/apps/python/lib/python2.7/subprocess.py", line 679, in
__init__
errread, errwrite)
  File "/share/apps/python/lib/python2.7/subprocess.py", line 1228, in
_execute_child
raise child_exception
OSError: [Errno 13] Permission denied

--
View this message in context: 
http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574967.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Windows Contextmenu

2012-03-13 Thread Prasad, Ramit
> > Now the script runs fine but I don't get all arguments from sys.argv.
> >
> > No mather how many files I mark in the explorer I only get one as an
> > argument.
> 
> You're missing out vital information:
> 
> * How have you attached this code to the context menu? What was
> the exact registry entry (or other method) you used?

>From a quick Google search, it seems that most of the context menu
entries open a single file. If multiple files are selected then
the command is called once for each file. The workaround seems
to check if the processes is already running and if it is then to
directly send it a "open" command.

That being said, since you are opening a web browser (or so it
seems to me based on the webbrowser.open), you should not have
an issue because modern web browsers will open each link in a tab.

To answer your question, you will not get more than one as an
argument. That is expected behavior. 

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Software Engineer -

2012-03-13 Thread Neil Cerutti
On 2012-03-13, Pedro H. G. Souto  wrote:
> On 2012-03-13 12:44 PM, Paul Rudin wrote:
>> Just out of interest why do people object to job adverts here?
>> Seems harmless enough...
>
> Wannabe list admins... Or list admins with a need to proof
> themselves... Or none of the above.

A job listing here or there would fine. If the discussion were
clogged with them, it would be really annoying.

In addition, it's more efficient to post job listing in a place
where people looking for jobs can easily find them, and it's
annoying and useless to post them in a place where reader not
looking for jobs have to delete them.

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


Re: Software Engineer -

2012-03-13 Thread Pedro H. G. Souto

On 2012-03-13 12:44 PM, Paul Rudin wrote:

Just out of interest why do people object to job adverts here? Seems
harmless enough...
Wannabe list admins... Or list admins with a need to proof themselves... 
Or none of the above.

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


Re: Installing Python Apps on Mac Lion

2012-03-13 Thread dilvanezanardine
Sábado, 25 de Junho de 2011 02h20min49s UTC+1, JKPeck escreveu:
> The Lion version of the OS on the Mac comes with Python 2.7 installed, but it 
> is in /System/Library/Frameworks/..., and this area is not writable by third 
> party apps.
> 
> So is there a consensus on what apps that typically install under the Python 
> site-packages directory should do in this situation?  Installing Python from 
> python.org puts it in the writable area /Library/Frameworks/Python.framework.
> 
> So, what should a Python app installer do?
> 
> Thanks

Hello,

currently I have:

/Library/Python/2.7/
/Library/Frameworks/Python.framework/Versions/2.7/
/Users/user/Library/Python/2.7/

With 3 folders "site-packages" and do not know why.
What's the difference?

Thanks.

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


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-13 Thread Kiuhnm

On 3/12/2012 20:00, Albert van der Horst wrote:
[...]

Sorry for triple posting. I hadn't noticed the follow up and I was 
blaming my newsserver.

BTW, Python is the next language (right after Perl) I'm going to learn.
Then I'll probably have a look at Ruby...

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


Re: concatenate function

2012-03-13 Thread Robert Kern

On 3/13/12 3:59 PM, ferreirafm wrote:

Hi Robert,
Thanks for you kind replay and I'm sorry for my semantic mistakes.
Indeed, that's what I'm doing: qsub-ing different cshell scripts. Certainly,
that's not the best approach and the only problem.


It's not a problem to write out a script and have qsub run it. That's a 
perfectly fine thing to do. You need to read the documentation for your job 
queue to find out the right arguments to give to qsub to make it wait until the 
first job finishes before executing the second job. This is not a Python 
problem. You just need to find the right flags to give to qsub.


Alternately, you could just make a single .qsub script running all three of your 
programs in a single job instead of making three separate .qsub scripts.



I've unsuccessfully tried
to set an os.environ and call qsub from it. However, subprocess.Popen seems
not accept to run "qsub" over a second program. Do you have a over come to
this issue?
Code goes here:
http://ompldr.org/vZDB5YQ


When you report a problem, you should copy-and-paste the output that you got and 
also state the output that you expected. I have no idea what you mean when you 
say "subprocess.Popen seems not accept to run "qsub" over a second program."


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: concatenate function

2012-03-13 Thread James Elford
On 13/03/12 16:02, ferreirafm wrote:
> Hi James, thank you for your replay. Indeed, the problem is qsub. And as
> warned by Robert, I don't have functions properly, but just scripts.
>  
> 
> --
> View this message in context: 
> http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574511.html
> Sent from the Python - python-list mailing list archive at Nabble.com.

It looks like you're not calling wait() on your subprocesses: you're
effectively launching a bunch of processes, then not waiting for them to
finish before you ask the next process to operate on the same file.

If you haven't given it a good look-over already, the subprocess
documentation [1] is worth taking a little time over.

[1]: http://docs.python.org/library/subprocess.html#popen-objects

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


Re: Software Engineer -

2012-03-13 Thread Paul Rudin
Chris Withers  writes:

> On 11/03/2012 09:00, Blue Line Talent wrote:
>> Blue Line Talent is looking for a mid-level software engineer with
>> experience in a combination of
>
> Please don't spam this list with jobs, use the Python job board instead:
>
> http://www.python.org/community/jobs/

Just out of interest why do people object to job adverts here? Seems
harmless enough...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread ferreirafm
Hi James, thank you for your replay. Indeed, the problem is qsub. And as
warned by Robert, I don't have functions properly, but just scripts.
 

--
View this message in context: 
http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574511.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread ferreirafm
Hi Robert, 
Thanks for you kind replay and I'm sorry for my semantic mistakes.
Indeed, that's what I'm doing: qsub-ing different cshell scripts. Certainly,
that's not the best approach and the only problem. I've unsuccessfully tried
to set an os.environ and call qsub from it. However, subprocess.Popen seems
not accept to run "qsub" over a second program. Do you have a over come to
this issue?
Code goes here:
http://ompldr.org/vZDB5YQ

--
View this message in context: 
http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574496.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread James Elford
On 13/03/12 14:35, ferreirafm wrote:
> Hi List,
> I've coded three functions that I would like to concatenate. I mean, run
> them one after another. The third function depends on the results of the
> second function, which depends on the results of the first one. When I call
> one function after another, python runs them at the same time causing
> obvious errors messages. I've tried to call one of them from inside another
> but no way. Any clues are appreciated.


> Complete code goes here: 
> http://ompldr.org/vZDB4OQ

Do you think you could provide a much shorter example to illustrate what
you need? In general, when you want to run one function on the result of
another, you can do something like:

<<< def increment_all(l);
... return [i+1 for i in l]

<<< increment_all(increment_all(range(3))
[2, 3, 4]

Here we apply the function increment_all to the result of the function
increment_all.

If you are talking about the "results" of each function in terms of it
mutating an object, and then the next function mutating the same object
in a (possibly) different way, then calling the functions in order will
do what you want.

l = [0, 3, 5, 2]
l.append(10)# [0, 3, 5, 2, 10]
l.sort()# [0, 2, 3, 5, 10]
l.append(3) # [0, 2, 3, 5, 10, 3]

James

> 
> 
> 
> --
> View this message in context: 
> http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574176.html
> Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: concatenate function

2012-03-13 Thread ferreirafm
Hi Ian, 
That what I have:
> burst.py
Your job 46665 ("top_n_pdb.qsub") has been submitted
Your job 4 ("extr_pdb.qsub") has been submitted
Your job 46667 ("combine_top.qsub") has been submitted

The first job runs quite well. The second is still runing and the third
issue the following:
>  more combine_top.qsub.e46667
ERROR: Cannot open PDB file "S_3MSEB_26_0032.pdb"
ERROR:: Exit from: src/core/import_pose/import_pose.cc line: 199



--
View this message in context: 
http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574337.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: concatenate function

2012-03-13 Thread Robert Kern

On 3/13/12 2:35 PM, ferreirafm wrote:

Hi List,
I've coded three functions that I would like to concatenate. I mean, run
them one after another. The third function depends on the results of the
second function, which depends on the results of the first one. When I call
one function after another, python runs them at the same time causing
obvious errors messages. I've tried to call one of them from inside another
but no way. Any clues are appreciated.
Complete code goes here:
http://ompldr.org/vZDB4OQ


Just to clarify, the Python functions are indeed running consecutively, not 
concurrently. Your Python functions write scripts and then use subprocess.call() 
to make qsub (an external program) to submit those scripts to a job queue. What 
you are calling a "function" in your post are these scripts. Please don't call 
them "functions". It's confusing.


Python is not running these scripts concurrently. Your job queue is. 
subprocess.call() will wait until qsub returns. However, qsub just submits the 
script to the job queue; it does not wait until the job is completed. Most 
qsub-using job queues can be set up to make jobs depend on the completion of 
other jobs. You will need to read the documentation of your job queue to figure 
out how to do this. Once you figure out the right arguments to give to qsub, 
your Python code is already more or less correct.


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-13 Thread Seymour J.
In , on 03/12/2012
   at 07:00 PM, Albert van der Horst  said:

>I know, but what the mathematicians do make so much more sense:

Not really; Mathematical notation is a matter of convention, and the
conventions owe as much to History as they do to logical necessity.
The conventions aren't even the same from author to author, e.g.,
whether "field" implies Abelian.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamt...@library.lspace.org

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


Re: concatenate function

2012-03-13 Thread Ian Kelly
On Tue, Mar 13, 2012 at 8:35 AM, ferreirafm  wrote:
> Hi List,
> I've coded three functions that I would like to concatenate. I mean, run
> them one after another. The third function depends on the results of the
> second function, which depends on the results of the first one. When I call
> one function after another, python runs them at the same time causing
> obvious errors messages. I've tried to call one of them from inside another
> but no way. Any clues are appreciated.
> Complete code goes here:
> http://ompldr.org/vZDB4OQ

They don't look to me like they would run at the same time --
subprocess.call is supposed to wait for the subprocess to finish.
What error messages are you getting?
-- 
http://mail.python.org/mailman/listinfo/python-list


concatenate function

2012-03-13 Thread ferreirafm
Hi List,
I've coded three functions that I would like to concatenate. I mean, run
them one after another. The third function depends on the results of the
second function, which depends on the results of the first one. When I call
one function after another, python runs them at the same time causing
obvious errors messages. I've tried to call one of them from inside another
but no way. Any clues are appreciated.
Complete code goes here: 
http://ompldr.org/vZDB4OQ



--
View this message in context: 
http://python.6.n6.nabble.com/concatenate-function-tp4574176p4574176.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-13 Thread Kiuhnm

On 3/12/2012 20:00, Albert van der Horst wrote:

In article<4f5df4b3$0$1375$4fafb...@reader1.news.tin.it>,
Kiuhnm  wrote:

On 3/12/2012 12:27, Albert van der Horst wrote:

Interestingly in mathematics associative means that it doesn't matter
whether you use (a.b).c or a.(b.c).
Using xxx-associativity to indicate that it *does* matter is
a bit perverse, but the Perl people are not to blame if they use
a term in their usual sense.


You may see it this way:
Def1. An operator +:SxS->S is left-associative iff
   a+b+c = (a+b)+c for all a,b,c in S.
Def2. An operator +:SxS->S is right-associative iff
   a+b+c = a+(b+c) for all a,b,c in S.
Def3. An operator +:SxS->S is associative iff it is both left and
right-associative.


I know, but what the mathematicians do make so much more sense:
(a+b)+c = a+(b+c)definition of associative.
Henceforth we may leave out the brackets.


That's Def3. I don't see your point.


Don't leave out the brackets if the operators if the operators is
not associative.


(1 - 1) - 1 != 1 - (1 - 1)
and yet we can leave out the parentheses.


P.S. There is no need for the operators to be SxS->S.
For example a b c may be m by n, n by l, l by k matrices respectively.


Ops, you're right.

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


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-13 Thread Kiuhnm

On 3/12/2012 20:00, Albert van der Horst wrote:

In article<4f5df4b3$0$1375$4fafb...@reader1.news.tin.it>,
Kiuhnm  wrote:

On 3/12/2012 12:27, Albert van der Horst wrote:

Interestingly in mathematics associative means that it doesn't matter
whether you use (a.b).c or a.(b.c).
Using xxx-associativity to indicate that it *does* matter is
a bit perverse, but the Perl people are not to blame if they use
a term in their usual sense.


You may see it this way:
Def1. An operator +:SxS->S is left-associative iff
   a+b+c = (a+b)+c for all a,b,c in S.
Def2. An operator +:SxS->S is right-associative iff
   a+b+c = a+(b+c) for all a,b,c in S.
Def3. An operator +:SxS->S is associative iff it is both left and
right-associative.


I know, but what the mathematicians do make so much more sense:
(a+b)+c = a+(b+c)definition of associative.
Henceforth we may leave out the brackets.


That's Def3. I don't see your point.


Don't leave out the brackets if the operators if the operators is
not associative.


(1 - 1) - 1 != 1 - (1 - 1)
and yet we can leave out the parentheses.


P.S. There is no need for the operators to be SxS->S.
For example a b c may be m by n, n by l, l by k matrices respectively.


Ops, you're right.

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


Re: are int, float, long, double, side-effects of computer engineering?

2012-03-13 Thread Albert van der Horst
In article <5aaded58-af09-41dc-9afd-56d7b7ced...@d7g2000pbl.googlegroups.com>,
Xah Lee   wrote:

>
>what i meant to point out is that Mathematica deals with numbers at a
>high-level human way. That is, one doesn't think in terms of float,
>long, int, double. These words are never mentioned. Instead, you have
>concepts of machine precision, accuracy. The lang automatically handle
>the translation to hardware, and invoking exact value or infinite
>precision as required or requested.

With e.g. a vanderMonde matrix you can easily make Mathematica fail.
If you don't understand what a condition number is, you can't use
Mathematica. And yes condition numbers are fully in the realm
of concepts of machine precisions and accuracy.

Infinite precision takes infinite time. Approaching infinite precious
may take exponentional time.

>
> Xah

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

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


Re: Windows Contextmenu

2012-03-13 Thread Tim Golden

On 13/03/2012 09:41, Szabo, Patrick (LNG-VIE) wrote:

I wrote the following Script which I want to run from the open with
contextmenu in Windows.

For that purpose I used py2exe to make an exe out of it.


[... snip ...]



Now the script runs fine but I don’t get all arguments from sys.argv.

No mather how many files I mark in the explorer I only get one as an
argument.


You're missing out vital information:

* How have you attached this code to the context menu? What was
the exact registry entry (or other method) you used?

* Does it work as native Python (ie without the py2exe layer)?

* Presumably the same issue occurs if you simply have: print sys.argv
  on its own (ie it's nothing to do with your loop and later code)

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


Re: How to break long method name into more than one line?

2012-03-13 Thread Chris Angelico
On Tue, Mar 13, 2012 at 9:30 PM, Jean-Michel Pichavant
 wrote:
> Chris Angelico wrote:
>>
>> Just never treat them as laws of physics (in
>> Soviet Physics, rules break you!).
>
> hum ...
> I wonder how this political message is relevant to the OP problem.

Ehh, it's a reference to the "in Soviet Russia" theme of one-liners.
You don't break the laws of physics, they break you. My point is that
rules about function names etc are *not* inviolate, and should be
treated accordingly.

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


Re: How to break long method name into more than one line?

2012-03-13 Thread Jean-Michel Pichavant

Chris Angelico wrote:

Just never treat them as laws of physics (in
Soviet Physics, rules break you!).

ChrisA
  


hum ...
I wonder how this political message is relevant to the OP problem.

JM

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


Windows Contextmenu

2012-03-13 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I wrote the following Script which I want to run from the open with
contextmenu in Windows. 

For that purpose I used py2exe to make an exe out of it. 

 

import sys, time, webbrowser

 

def main():

for para in sys.argv[1:]:

print sys.argv

print "###"

print para

url = "http://production.lexisnexis.at:8080/cocoon/glp/html/%s";
% str(para).replace("R:\\", "").replace(".xml", ".html")

webbrowser.open_new(url)

time.sleep(10)



if __name__ == "__main__":

main() 

 

Now the script runs fine but I don't get all arguments from sys.argv.

No mather how many files I mark in the explorer I only get one as an
argument. 

 

Can anyone tell me how to overcome this issue ?

 

Best regards

 

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 





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