Re: Using a Variable Inside the String

2019-05-10 Thread Thomas Jollans
On 07/05/2019 18.43, Rob Gaddi wrote:
> This over here is my friend Bob.  What's 31 + 18 + Bob?

That's Numberwang!
-- 
https://mail.python.org/mailman/listinfo/python-list


How to debug a function under the (pdb) prompt?

2019-05-10 Thread jfong
For example, there is a file test0.py:
-
1  def foo():
2  for i in range(3):
3  print(i)
4
5  x = 0
-
I start the debug session as below. My question is why the break point at line 
3 didn't work. How to debug the function foo() at this time?

D:\Works\Python>py -m pdb test0.py
> d:\works\python\test0.py(1)()
-> def foo():
(Pdb) tbreak 5
Breakpoint 1 at d:\works\python\test0.py:5
(Pdb) cont
Deleted breakpoint 1 at d:\works\python\test0.py:5
> d:\works\python\test0.py(5)()
-> x = 0
(Pdb) tbreak 3
Breakpoint 2 at d:\works\python\test0.py:3
(Pdb) foo()
0
1
2
(Pdb)
-- 
https://mail.python.org/mailman/listinfo/python-list


How to append horizontally the data array from the FOR loop?

2019-05-10 Thread Madhavan Bomidi
Hi,

I have to append requisite data matrix from multiple files into a single 
variable using FOR loop.

outData = [];

for file in fileList:
   
   
   
   allData = # an array of nrows and ncols.
   outData = [outData; allData]  # in MATLAB

While the ncols are constant, the nrows will vary. My intention is to append 
the allData (with variable rows) from each file into the outData. 

1. Can anyone suggest how I can do this with an example?

2. How can I save this outData (data matrix) with delimiter (comma) and 
precision of '%8.5f' or any other into a .txt or .csv file or any other type?

3. How can I append the header on the top of this output file?

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


Re: How to append horizontally the data array from the FOR loop?

2019-05-10 Thread Rhodri James

On 10/05/2019 16:08, Madhavan Bomidi wrote:

Hi,

I have to append requisite data matrix from multiple files into a single 
variable using FOR loop.

outData = [];

for file in fileList:



allData = # an array of nrows and ncols.
outData = [outData; allData]  # in MATLAB

While the ncols are constant, the nrows will vary. My intention is to append 
the allData (with variable rows) from each file into the outData.

1. Can anyone suggest how I can do this with an example?


I don't do homework :-)  What format are your input files in?  Is there 
something that will already that for you?  Python comes with "batteries 
included", i.e. there are many modules in the standard library that will 
likely make life easier.



2. How can I save this outData (data matrix) with delimiter (comma) and 
precision of '%8.5f' or any other into a .txt or .csv file or any other type?

3. How can I append the header on the top of this output file?


Have you looked at the csv module in the standard library?

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Farewell, Python 3.4

2019-05-10 Thread Informatico de Neurodesarrollo

Good job, Larry !!!


El 08/05/19 a las 11:36, Larry Hastings escribió:


It's with a note of sadness that I announce the final retirement of 
Python 3.4.  The final release was back in March, but I didn't get 
around to actually closing and deleting the 3.4 branch until this 
morning.


Python 3.4 introduced many features we all enjoy in modern Python--the 
asyncio, ensurepip, and enum packages, just to name three.  It's a 
release I hope we all remember fondly.


My eternal thanks to all the members of the release team that worked 
on Python 3.4:


   Georg Brandl

   Julien Palard

   Martin von Löwis

   Ned Deily

   Steve Dower

   Terry Reedy

   and all the engineers of the Python infrastructure team.

Special thanks to Benjamin Peterson and Ned Deily, who frequently 
scurried around behind the scenes cleaning up the messes I cluelessly 
left in my wake.


Having closed 3.4, I am now retired as Python 3.4 Release Manager.  I 
regret to inform all of you that you're still stuck with me as Python 
3.5 Release Manager until sometime next year.



My very best wishes,


//arry/



--

Ing. Jesús Reyes Piedra
Admin Red Neurodesarrollo,Cárdenas
La caja decía:"Requiere windows 95 o superior"...
Entonces instalé LINUX.


--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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


CheetahTemplate 3.2.3

2019-05-10 Thread Oleg Broytman
Hello!

I'm pleased to announce version 3.2.3, the third bugfix release of branch
3.2 of CheetahTemplate3.


What's new in CheetahTemplate3
==

Bug fixes:

  - Fixed infinite recursion in ``ImportManager`` on importing
a builtin module.

Documentation:

  - The site https://cheetahtemplate.org/ is now served with HTTPS.
  - Updated docs regarding fixed tests.

Tests:

  - Removed ``unittest.main()`` calls from tests:
``python -m unittest discover -t Cheetah -s Cheetah/Tests -p '[A-Z]*.py'``
does it.
  - Fixed ``cheetah test`` command.
  - Fixed script ``buildandrun``: copy test templates
to the ``build/lib`` directory.


What is CheetahTemplate3


Cheetah3 is a free and open source template engine.
It's a fork of the original CheetahTemplate library.

Python 2.7 or 3.4+ is required.


Where is CheetahTemplate3
=

Site:
https://cheetahtemplate.org/

Development:
https://github.com/CheetahTemplate3

Download:
https://pypi.org/project/Cheetah3/3.2.3

News and changes:
https://cheetahtemplate.org/news.html

StackOverflow:
https://stackoverflow.com/questions/tagged/cheetah


Example
===

Below is a simple example of some Cheetah code, as you can see it's practically
Python. You can import, inherit and define methods just like in a regular Python
module, since that's what your Cheetah templates are compiled to :) ::

#from Cheetah.Template import Template
#extends Template

#set $people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick',
'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 
'Hairy'}]

How are you feeling?

#for $person in $people

$person['name'] is $person['mood']

#end for


Oleg.
-- 
Oleg Broytmanhttps://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Django Potential Fork Bomb

2019-05-10 Thread Peter J. Holzer
On 2019-05-09 14:21:15 +0530, Shakti Kumar wrote:
> On Thu, 9 May 2019 at 10:27, dieter  wrote:
> > Shakti Kumar  writes:
> > > I suspect django spawned too many child processes, and consecutively I ran
> > > out of resources on my dev server. How can I prevent this from happening?
> > > And I am not able to understand why django should spawn (if it indeed is
> > > spawning) incrementing processes with each query from the GUI.
> >
> > I suspect the GUI to be the culprit. You have not told us what
> > kind of GUI this is: is it the (standard) GUI which comes with "Django"
> > (and runs in your browser)?
> 
> Yes the standard GUI shipped with Django.

This may be a stupid question, but what is the standard GUI shipped with
Django? What does it do and how do you start it? 

I suppose one could call the django.contrib.admin app "the Django GUI",
but that doesn't seem to fit your description that it executes code in
*your* app.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to append horizontally the data array from the FOR loop?

2019-05-10 Thread Cameron Simpson

On 10May2019 08:08, Madhavan Bomidi  wrote:
I have to append requisite data matrix from multiple files into a 
single variable using FOR loop.


outData = [];
for file in fileList:
  
  allData = # an array of nrows and ncols.
  outData = [outData; allData]  # in MATLAB
While the ncols are constant, the nrows will vary. My intention is to 
append the allData (with variable rows) from each file into the 
outData.


1. Can anyone suggest how I can do this with an example?


See the .append and .extend methods for lists in the python 
documentation. (It is often easiest to go to the index and look up the 
method if the documentation section is not obvious).


Which method you want depends on what "allData" really is. I would guess 
.append, that is the common case.



2. How can I save this outData (data matrix) with delimiter (comma) and 
precision of '%8.5f' or any other into a .txt or .csv file or any other type?


As Rhodri has suggested, see the "csv" module in the documentation. Open 
a csv writer, and assemble rows and write them out in a loop.



3. How can I append the header on the top of this output file?


You don't. You write the header first, as the first row.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list