Re: Ann: New Python curses book

2021-03-30 Thread William Ray Wing via Python-list
I’ve ordered the book (physical volume). It will fulfill a need I’ve had for 
some time.  Unfortunately, it is only available in the UK store, so the 
shipping cost by far outweighs the book’s cost.  Hope for other’s sake, it 
migrates to the other Amazon stores fairly quickly.

Thanks,
Bill

> On Mar 30, 2021, at 7:12 AM, Alan Gauld via Python-list 
>  wrote:
> 
> I've just published, in Kindle and paperback formats,
> my book on "Programming curses with Python".
> 
> https://www.amazon.co.uk/dp/B091B85B77/
> 
> (It should be available in most other Amazon stores too)

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


Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-26 Thread William Ray Wing via Python-list



> On Jan 26, 2021, at 2:00 PM, C W  wrote:
> 
> Hello everyone,
> 
> I'm a long time Matlab and R user working on data science. How do you
> troubleshooting/debugging in Python?
> 

Another approach is to run the code in an IDE.  I happen to use Wing, but that 
is a coincidence.  But almost ANY IDE will let you set a break point, then 
single-step through your code starting at the break point and examine the 
values of your variables at each step.  Sometimes this is an awfully big hammer 
for what is a head-slapping mistake.  But it has never failed me.

Good luck,
Bill

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


Re: questions re: calendar module

2020-08-01 Thread William Ray Wing via Python-list

> On Aug 1, 2020, at 10:35 AM, o1bigtenor  wrote:
> 
> On Sat, Aug 1, 2020 at 9:29 AM o1bigtenor  wrote:
>> 
>>> On Sat, Aug 1, 2020 at 6:58 AM Peter Otten <__pete...@web.de> wrote:
>>> 
>>> o1bigtenor wrote:
>>> 
>>> import calendar
>>> print (calendar.calendar(2024,1,1,2,8))
>>> 
 I would like to show something like 2024 through the end of 2028.
>>> 
>>> print("\n".join(cd.calendar(year) for year in range(2024, 2029)))
>> 
>> 
>> Sorry - - - - 1st response was to only Mr Peter - - - hopefully this is
>> useful to more than I so here is that to all.
>>> 
>>> 
>> 
> print("\n".join(cd.calendar(year) for year in range(2024, 2029)))
>> Traceback (most recent call last):
>>  File "", line 1, in 
>>  File "", line 1, in 
>> NameError: name 'cd' is not defined
>> 
>> so 'cd' seems to be a problem.
>> 
>> Tried changing 'cd' to calendar and that gives the desired response.
>> 
>> Except its a neat 3 months wide very very very many rows of calendar.
>> 
>> I'm trying to figure out how to do something like this:
>> 
>>November 2022  December 2022
>>January 2023February 2023
>> March 2023April 2023
>> May 2023
>>   Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa  Su Mo Tu
>> We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
>> Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
>> 1231  2  3  4  5 127  1  2  3
>>132  1  2  3  4  5  6  7  136   1  2  3  4  140
>> 1  2  3  4  1441  149 1  2  3  4  5  6
>> 124  6  7  8  9 10 11 12  128  4  5  6  7  8  9 10  133  8  9 10 11 12
>> 13 14  137  5  6  7  8  9 10 11  141  5  6  7  8  9 10 11  145  2  3
>> 4  5  6  7  8  150  7  8  9 10 11 12 13
>> 125 13 14 15 16 17 18 19  129 11 12 13 14 15 16 17  134 15 16 17 18 19
>> 20 21  138 12 13 14 15 16 17 18  142 12 13 14 15 16 17 18  146  9 10
>> 11 12 13 14 15  151 14 15 16 17 18 19 20
>> 126 20 21 22 23 24 25 26  130 18 19 20 21 22 23 24  135 22 23 24 25 26
>> 27 28  139 19 20 21 22 23 24 25  143 19 20 21 22 23 24 25  147 16 17
>> 18 19 20 21 22  152 21 22 23 24 25 26 27
>> 127 27 28 29 30   131 25 26 27 28 29 30 31  136 29 30 31
>>   140 26 27 28  144 26 27 28 29 30 31 148 23 24
>> 25 26 27 28 29  153 28 29 30 31
>> 
>>   149 30
>> 
>>   June 2023 July 2023August 2023
>>   September 2023 October 2023
>> November 2023 December 2023
>>Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th
>> Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo
>> Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
>> 153  1  2  3  1571  1621  2  3
>> 4  5  166 1  2  171  1  2  3  4  5  6  7  175
>>  1  2  3  4  179 1  2
>> 
>> The formatting here is a mess.
> 
> (Its an even bigger mess now when its truncated to 80 columns. Can't change
> the mess but I can tell you that it doesn't 'look that way'! Don't know how to
> include an example in the body and have it be even a bit accurate - - - please
> advise if there is a way.)
> 

If you want us to see it in its exact form, print to PDF, post/share It on 
Dropbox. 

>> The months are centered. The week numbers are consecutive from the
>> starting date.
>> The dates are centered under the weekday name. If you've ever used
>> ncal its like that except
>> that I can now have up to 7 months wide if the terminal is wide enough
>> (>180 columns IIRC).
>> A mentor was working on this in Perl but as he died some couple months
>> ago its up to me
>> to make what I want.
>> Because it seems like there are a lot of disparate things happening
>> its not very straight
>> forward trying to replicate and extend my friend's efforts except in
>> Python. (My friend
>> preferred to work in Perl rather than Python and I'm wanting to learn
>> Python. I understand
>> that this is not perhaps the easiest way to learn something but it
>> sure is interesting!)
>> 
>> TIA
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Tutor] Questions

2019-04-08 Thread William Ray Wing via Python-list
Diana, I’m answering you via the Tutor list - please, the accepted protocol is 
to send all questions and answers to the list so answers can be seen by (and 
possibly help) others.

Having said that, I should have paid more attention to your original question, 
which is really going to require answers that are beyond the typical Tutor 
question level, so I’m also forwarding to the main Python list where you should 
be able to get pointers.

But let me ask, how much programming do you know? Python is a full-blown 
programming language, like Java or C.  Have you written programs before that, 
for example can accept a file name from a user, open that file, and read its 
contents?  If yes, then I apologize, and would point you at:


https://medium.freecodecamp.org/how-to-scrape-websites-with-python-and-beautifulsoup-5946935d93fe
 


https://towardsdatascience.com/how-to-web-scrape-with-python-in-4-minutes-bc49186a8460

https://realpython.com/python-web-scraping-practical-introduction/
or
https://docs.python-guide.org/scenarios/scrape/

The next steps would probably involve loading that scraped data into Pandas:


https://pandas.pydata.org/pandas-docs/stable/getting_started/tutorials.html


https://data36.com/pandas-tutorial-1-basics-reading-data-files-dataframes-data-selection/

https://www.tutorialspoint.com/python_pandas

On the other hand, if your answer to my question is: “no” - then you should 
take a look at any of the really vast
collection of web sites devoted to Python learning.  Note that Python was 
originally designed to be a language that would be easy for beginners to learn. 
 It still is - I’d claim it is about the easiest -

>>> print( "Hello world!" ) 
Hello world!

Those lines were lifted from Alan Gauld’s learn to program web site.

Let us know how we can help.

Bill


> On Apr 8, 2019, at 5:40 PM, Diana Katz  wrote:
> 
> Yes - data would need to be scraped from sec.gov <http://sec.gov/> website. 
> I want to be able to pull up segment data from 10-Q filings of individual 
> companies by putting in a ticker (preferably in excel, but an be done 
> elsewhere).  Trying to figure out how to even start setting this up. 
> 
> Thank you!
> 
> On Sun, Apr 7, 2019 at 8:57 PM William Ray Wing  <mailto:w...@mac.com>> wrote:
> 
> 
> > On Apr 5, 2019, at 8:01 PM, Diana Katz  > <mailto:diana.k...@gmail.com>> wrote:
> > 
> > 1) Can you use python from excel? Or just export to excel?
> 
> Simple answer: no.  Python can read and write excel files through libraries:
> 
>  https://www.datacamp.com/community/tutorials/python-excel-tutorial 
> <https://www.datacamp.com/community/tutorials/python-excel-tutorial> 
> 
> > 2) I am trying to see if there's a way using python to automate all of this
> > work that I need to do. I have to collect quarterly segment data for
> > hundreds of public companies and go back at least 12-16 quarters. We use an
> > aggregator like factset and they actually don't have this option available
> > in an automated way. So I'm trying to see if there's a way to build this.
> 
> We really need more information to be of any help.  Is the starting data 
> coming from a web site?
> Python scripts can interact with web sites, “scrape” data from them or read 
> data from files downloaded in response to the script's interaction with the 
> site. The python library Pandas (named by its originator in the financial 
> field where such data is referred to as “panel” data) is optimized for 
> manipulating spreadsheet-like tables of data (it includes a pivot operation).
> 
> > Basically, I get my data from sec.gov <http://sec.gov/> and they have 
> > interactive data - they
> > even have the data in excel (though it's a messy file and hard to read). I
> > attached some of the steps and the data that i'd want to see.
> > Basically i'd want the excel to look like:
> > old to new quarters - going back 12 to 16 quarters (more if possible but
> > not if it will stop the project).
> > Columns: 3/31/2017, 6/30/2017, 9/30/17, 12/31/17, 3/313/2018...
> > Rows:
> > Sales for segment A
> > Sales for Segment b
> > Sales for SEgment C
> > …(for as many segments as they have)
> > 
> > Earnings for Segment A
> > .Earnings for Segment B
> > 
> > Depreciation for Segment A
> > Depreciation for Segment B
> > Depreciation for Segment C...
> > 
> > I included where I get the data in the attached document.
> 
> Since attachments can contain unknown contents, this list drops them.
> 
> Bill
> 
> > 
> > All the best,
> > 
> > Diana Katz
> > ___
> > Tutor maillist  -  tu...@python.org <mailto:tu...@python.org>
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor 
> > <https://mail.python.org/mailman/listinfo/tutor>
> 

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


Re: Levenberg-Marquardt non-linear least-squares fitting in Python [follow-on]

2019-03-28 Thread William Ray Wing via Python-list
Below I’ve included the code I ran, reasonably (I think) commented.  Note the 
reference to the example.  The data actually came from a pandas data frame that 
was in turn filled from a 100 MB data file that included lots of other data not 
needed for this, which was a curve fit to a calibration run.

Bill

PS:  If you want, I can probably still find a couple of the plots of the raw 
data and fitted result.
-
import numpy as np, matplotlib.pyplot as plt
#
#  Inverted exponential that axymptotically approaches "a" as x gets large
#
def func2fit(x,a,b,c):
return a - b * np.exp(-c * x)

# Curve fitting below from: 
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html
  
from scipy.optimize import curve_fit
def fit(xdata, ydata, run_num):
ll = len(xdata)
#
#  The next four lines shift and scale the data so that the curve fit routine 
can
#  do its work without needing to use 8 or 16-byte precision. After fitting, we
#  will scale everything back.
#
ltemp = [ydata[i] - ydata[0] for i in range(ll)]
ytemp = [ltemp[i] * .001 for i in range(ll)]
ltemp = [xdata[i] - xdata[0] for i in range(ll)]
xtemp = [ltemp[i] * .001 for i in range(ll)]
#
#  popt is a list of the three optimized fittine parameters [a, b, c]
#  we are interested in the value of a.
#  cov is the 3 x 3 covariance matrix, the standard deviation (error) of the 
fit is
#  the square root of the diagonal.
#
popt,cov = curve_fit(func2fit, xtemp, ytemp)
#
#  Here is what the fitted line looks like for plotting
#
fitted = [popt[0] - popt[1] * np.exp(-popt[2] * xtemp[i]) for i in 
range(ll)]
#
#  And now plot the results to check the fit
#
fig1, ax1 = plt.subplots()
plt.title('Normalized Data ' + str(run_num))
color_dic = {0: "red", 1: "green", 2: "blue", 3: "red", 4: "green", 5: 
"blue"}
ax1.plot(xtemp, ytemp, marker = '.', linestyle  = 'none', color = 
color_dic[run_num])
ax1.plot(xtemp, fitted, linestyle = '-', color = color_dic[run_num])
plt.savefig('Normalized ' + str(run_num))
perr = np.sqrt(np.diag(cov))
return popt, cov, xdata[0], ydata[0], fitted, perr[0] 

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


Re: Levenberg-Marquardt non-linear least-squares fitting in Python

2019-03-28 Thread William Ray Wing via Python-list


> On Mar 28, 2019, at 7:54 AM, Madhavan Bomidi  wrote:
> 
> Hi,
> 
> I have x and y variables data arrays. These two variables are assumed to be 
> related as y = A * exp(x/B). Now, I wanted to use Levenberg-Marquardt 
> non-linear least-squares fitting to find A and B for the best fit of the 
> data. Can anyone suggest me how I can proceed with the same. My intention is 
> to obtain A and B for best fit.
> 

Have you looked at the non-linear least-squares solutions in scicpy?
Specifically, a system I’ve had to solve several times in the past uses it and 
it works quite well.

from scipy.optimize import curve_fit

def func2fit(x,a,b,c):
return a - b * np.exp(-c * x)

Bill

> Look forward to your suggestions and sample code as an example.
> 
> Thanks and regards,
> Madhavan
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: the python name

2019-01-04 Thread William Ray Wing via Python-list

> On Jan 4, 2019, at 11:34 AM, Avi Gross  wrote:
> 
> 

[BYTE]

> As I joked in an earlier message, I remember using a version of FORTRAN 
> called WATFOR. Yes, there was a WATFIV. 
> 
> 

Yah - WATFOR was Waterloo FORTRAN, an interpreted FORTRAN that was used a lot 
in intro classes.  No matter what the student did (negative indexes in early 
FORTRAN would get you down into the OS), under WATFOR the mainframe (yup) 
wouldn’t crash.

Bill

PS:  I, for one will drop this now as it is getting further off topic.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the python name

2019-01-04 Thread William Ray Wing via Python-list
On 3/01/19 2:03 PM, Avi Gross wrote:
> Challenge: Can we name any computer language whose name really would suggest 
> it was a computer language?
> I think the name is the least important aspect of a computer language.

I’d like to propose that classic FORTRAN (FORmulaTRANslator) came/comes close.

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


Re: Creating Win .exe file from *.py on Linux

2018-10-02 Thread William Ray Wing via Python-list


> On Oct 2, 2018, at 3:03 PM, John Doe  wrote:
> 
> Hello World
> 
> Is it possible to create on Linux win .exe file from *.py file?
> -- 
> https://mail.python.org/mailman/listinfo/python-list

As was pointed out here a day or so ago, the answer is yes, but it is a two 
step process.  First step is to use Cython to compile the python file to C 
source, then compile that to a binary executable.  The link given was:


https://medium.com/@xpl/protecting-python-sources-using-cython-dcd940bb188e 

Where the focus is keeping the python source away from prying eyes, but it 
generates exactly what you want.

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


Re: How to change '\\' to '\'

2018-10-01 Thread William Ray Wing via Python-list


> On Oct 1, 2018, at 10:17 PM, Jach Fong  wrote:
> 
> Thanks for your info about how Windows supports the forward slash.
> 
> I don't quit sure what is the meaning of "top posting" in your mail.
> If its meaning (forgive me if I was wrong) is where the reply was put
> in mail, I have reason of standing on the opposite side.
> 

Yes, exactly correct 

> It was supposed that most discussant want to see the reply message
> instantly when they open the mail. They already know what is going on
> and no need to pass through all those previous message. "top posting"
> seems more reasonable to me:-)
> 

The problem is that it is comparatively rare for there to be a singleton Q and 
immediate A.  Even seemingly simple questions frequently trigger fairly long 
discussions, which assume familiarity with the earlier discussion. AND this 
list is pretty much the place of record for people researching python IFAQs 
(infrequently asked questions). So, six months from now a Google search that 
turns up a relevant thread will make sense only if it can be read as in-lined 
comments like this. 

> --Jach
> 
> mm0fmf at 2018/10/2 AM 05:05 wrote:
>>> On 01/10/2018 10:19, Jach Fong wrote:
>>> Hmmm...strange, I didn't see Rick's mail:-(
>>> 
>>> Sure the forward slash is better, not to cause this confusion.
>>> But I am curious, since when, I mean, since which version
>>> Windows start to accept forward slash?
>>> 
>> First, stop top posting.
>> Second, ISTR that all Windows NT versions and versions derived from the NT 
>> codebase support forward slash in pathnames given to functions. It may go 
>> back further, but anything derived from NT works.  I can't remember which 
>> Windows command shells support it, probably PowerShell does.
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Matplotlib 3D limitations, please recommend alternative

2018-07-04 Thread William Ray Wing via Python-list

> On Jul 4, 2018, at 5:53 PM, John Ladasky  wrote:
> 
> I'm a regular Matplotlib user.  Normally, I graph functions.  I just 
> attempted to graph an icosahedral surface using the plot_trisurf() methods of 
> Matplotlib's Axes3D. I have discovered that Matplotlib is basically 
> hard-wired for graphing functions, and therefore will not work for 
> general-purpose 3D rendering.
> 
> If I have repeated X and Y values in my arrays, it doesn't matter that the Z 
> values might be different.  Matplotlib raises a ValueError, with the message 
> "x and y arrays must consist of at least 3 unique points."  If I break down 
> my polyhedron into individual triangles, I can get 16 of the 20 faces to 
> render, but not all of them.  Here's some minimal example code, which also 
> catches and prints the cause of the ValueError.
> 
> 

[big byte]


> # 
> 
> I explored Python OpenGL bindings about three years ago, and quickly got 
> bogged down.  Even with Python to assist, dealing with OpenGL was like trying 
> to program Java.  Of course, OpenGL can do EVERYTHING.  Far more than I need.
> 

The Python Open GL bindings have apparently changed fairly dramatically.  I’m 
no expert, I’m working my way through the on-line book here:

http://www.labri.fr/perso/nrougier/python-opengl/

But the author DOES lay things out in a nice step by step fashion - and with 
particular emphasis on scientific 3D plotting (which is what
I’m after).


> I would like to render polyhedra, preferably with uniformly colored faces (I 
> understand that color is a property that is associated with vertices in 
> OpenGL).  I would appreciate a simple interface.  The rendering doesn't have 
> to be especially fast or high quality.  The Matplotlib visualization is 
> acceptable, except of course for the missing faces.
> 
> There are many 3D graphics packages on PyPI.  Some appear to be quite 
> specialized.  I would appreciate your recommendations.  Thanks!
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Scanner freakishness [was Re: Python list vs google group]

2018-06-16 Thread William Ray Wing

> On Jun 16, 2018, at 9:10 AM, Steven D'Aprano 
>  wrote:
> 
> On Sat, 16 Jun 2018 11:54:15 +1000, Chris Angelico wrote:
> 
>> On Sat, Jun 16, 2018 at 11:00 AM, Jim Lee  wrote:
> 
>>> I once had a Mustek color scanner that came with a TWAIN driver.  If
>>> the room temperature was above 80 degrees F, it would scan in color -
>>> otherwise, only black & white.  I was *sure* it was a hardware problem,
>>> but then someone released a native Linux driver for the scanner.  When
>>> I moved the scanner to my Linux box, it worked fine regardless of
>>> temperature.
>>> 
>>> 
>> I would be mind-blown if I did not have the aforementioned too many
>> hours. Sadly, I am merely facepalming. Wow.
> 
> 

Let me add one more story (true) to the list.  Concerns an old IBM mainframe 
installed in a bank in New York City, that crashed rarely, and only night, 
never during the day.  They called IBM; repair man spent the night with it - no 
crash; same story the next night and the next.  Finally on the forth night he 
left around 10:00 PM to get something to eat and some coffee.  Came back to 
find the computer had crashed.  Spent the next night - no crash.  Left the next 
again for coffee, came back to find the computer down.  Obviously it was only 
crashing when he wasn't watching.  Next night he left, but only took the 
elevator down to the ground floor, didn’t go outside.  Computer crashed.  He 
rebooted, restarted the job stream, left the computer room for the same length 
of time, but didn’t leave the floor.  No crash.

To make a long story short, it was the motor-generator set that ran the 
elevators.  During the day, there was enough constant elevator traffic so that 
the MG set never shut down and even it it did, there was enough load elsewhere 
in the building to make the start-up transient a relatively small perturbation. 
 At night it would time out, shut down, and when he called for the elevator 
late at night, the start-up transient was too much for the computer’s power 
regulators.

Earlier crashes turned out to be coincident with janitorial staff working extra 
late after special events.

Bill


> 
> -- 
> Steven D'Aprano
> "Ever since I learned about confirmation bias, I've been seeing
> it everywhere." -- Jon Ronson
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: please test the new PyPI (now in beta)

2018-03-30 Thread William Ray Wing

> On Mar 28, 2018, at 10:50 AM, sumana.hariharesw...@gmail.com wrote:
> 
> 

[byte]


> : I ask you the usual list of troubleshooting questions. What OS and browser 
> are you using, what plugins and particularly interesting preferences are you 
> using, and so on. (When I turn off JavaScript in my browser, I see a list of 
> clickable category headings like "By Programming Language" but clicking on 
> them causes no response.) A screenshot in an issue at 
> https://github.com/pypa/warehouse/issues would be helpful. (Reminder that 
> participating in Warehouse development, including by filing an issue, 
> requires abiding by the PyPA Code of Conduct 
> https://www.pypa.io/en/latest/code-of-conduct/ .)
> 

Sumana, I want to be sure we aren’t just talking past each other.  I notice 
that the URL you seem to always reference is: 

https://pypi.org/search/

and if I go there, I get the filter list immediately.  The place I don’t see it 
is the home page:

https://pypi.org/

where I’m invited to “Search” or “Browse”, but where there is no filter list.  
The filter list only appears after I’ve performed my first search.

Thanks,
Bill


> -Sumana Harihareswara
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: please test the new PyPI (now in beta)

2018-03-28 Thread William Ray Wing

> On Mar 28, 2018, at 10:50 AM, sumana.hariharesw...@gmail.com wrote:
> 
> 

[byte]

> 
> People who literally don't see the list of ways to filter on the left-hand 
> side of https://pypi.org/search/

I do see the list of filters, but I only get it AFTER I’ve entered my first 
search term.  I may be an outlier here, but I find that an unfortunate bit of 
UI design.  I suppose it is deliberate in that the filters can then be used to 
narrow search results, but if I know going in that I’m only interested in a 
particular set of results, I’d like to be able to apply that filter to my first 
search.

Thanks,
Bill


> : I ask you the usual list of troubleshooting questions. What OS and browser 
> are you using, what plugins and particularly interesting preferences are you 
> using, and so on. (When I turn off JavaScript in my browser, I see a list of 
> clickable category headings like "By Programming Language" but clicking on 
> them causes no response.) A screenshot in an issue at 
> https://github.com/pypa/warehouse/issues would be helpful. (Reminder that 
> participating in Warehouse development, including by filing an issue, 
> requires abiding by the PyPA Code of Conduct 
> https://www.pypa.io/en/latest/code-of-conduct/ .)
> 
> -Sumana Harihareswara
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread William Ray Wing

> On Dec 30, 2017, at 7:46 AM, Peter J. Holzer  wrote:
> 
> On 2017-12-29 19:09:35 -0500, Dennis Lee Bieber wrote:
>> On Fri, 29 Dec 2017 23:12:22 +, bartc  declaimed the
>> following:
>>> Looking at 14 million lines of Linux kernel sources, which are in C, 
>>> over 100,000 of them use 'goto'. About one every 120 lines.
>>> 
>> 
>>  C is a language that predates the "structured programming" concepts of
>> the late 70/early 80.
> 
> I don't think this is correct. Structured programming is much older:
> ALGOL 60 was already a block structured language and Dijkstra wrote
> "goto considered harmful" in the late 1960s. Pascal appeared in 1970, C
> in 1974. To me (who learned to program in BASIC on a CP/M machine), C
> is very much a structured programming language. If structured
> programming gained traction around 1980, it might even have been because
> structured languages like C with good performance became widely
> available.
> 
> That said, C lacks exception handling (well, there is setjmp/longjmp,
> but ...) and multi-level break/continue, so goto is often the cleanest
> way to abort what you are doing and start to clean up. Python has
> exception handling, and that removes most of the cases where you would
> use goto in C (the rest is probably mostly in micro-optimizations: If
> you care about the run-time difference between a goto and a subroutine
> call, you probably shouldn't use Python in the first place).
> 
>hp
> 

I’ve been watching this discussion ebb and flow - and finally can’t resist 
pointing folks here at the famous essay: “Real Programmers Don’t Use Pascal”.  
It has its own Wikipedia article at this point:

 https://en.wikipedia.org/wiki/Real_Programmers_Don't_Use_Pascal

A copy of the original essay appears here: 
https://www.ee.ryerson.ca/~elf/hack/realmen.html

Hopefully fun reading over a beer.

Bill


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


Re: plot map wit box axes

2017-12-24 Thread William Ray Wing

> On Dec 23, 2017, at 3:27 PM, breamore...@gmail.com wrote:
> 
> On Friday, December 22, 2017 at 3:42:58 PM UTC, jorge@cptec.inpe.br wrote:
>> Hi,
>> 
>> I use the PYTHON and IDL. In IDL I can plot a grid map like a this 
>> figure (mapa.png). Please, I would like know how can I plot my figure 
>> using PYTHON with the box around the figure. Like this that I plot using 
>> the IDL.
>> 
>> Thanks
> 
> Sorry but we can't see the image as it gets stripped off this text only 
> mailing list.  What are you using to do the plot, matplotlib or smething 
> else?  Can you show us the code you've used or your interactive session in 
> IDLE?
> 

I’m 90% sure the OP really meant IDL, not IDLE.  IDL (Interactive Data 
Language) is a long-time competitor to MatLab, and is widely used in various 
parts of the scientific community.  (Don’t know if it is still true, but for 
years ALL the published images from the Hubble telescope had been processed 
through IDL.)

Bill

> --
> Kindest regards.
> 
> Mark Lawrence.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Python noob having a little trouble with strings

2017-10-28 Thread William Ray Wing
OSX has been shipping with Python 2.7 for several years.  I’m not sure why you 
are seeing 2.6.

Bill

> On Oct 27, 2017, at 2:48 AM, Lutz Horn  wrote:
> 
> On Thu, Oct 26, 2017 at 07:59:10PM -0700, randyli...@gmail.com wrote:
>> Hi Bob, thanks for responding. I'm not sure where to do so, my
>> professor had us download Pycharm for mac's which uses python 2.6
> 
> The code from your question is not specific to Python 2 or 3. Just try
> it in the Python installation you have available.
> 
> Lutz
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Let's talk about debuggers!

2017-10-25 Thread William Ray Wing

> On Oct 25, 2017, at 9:07 AM, Thomas Jollans  wrote:
> 
> 

[byte]

> What options are there for Python (that work)? What text editors (and
> IDEs) have a decent integrated debugger or debugging plugin?

I rather like WingIDE (the name is a coincidence).  It allows insertion/removal 
of break points while the code is running.  While execution is stopped, it 
allows direct inspection of the stack (no surprise), but in addition allows 
execution of python statements or program elements typed into an auxiliary 
window - including importing things like matplotlib and plotting the current 
state of data arrays.  Its editor is syntax-aware and highlights accidental 
syntax errors as they are typed.  Lots of other features, those just happen to 
be the ones I use most often.

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


Re: How to track usage within a desktop python application

2017-10-08 Thread William Ray Wing

> On Oct 8, 2017, at 8:38 PM, Ryan Holmes  wrote:
> 
> I maintain a desktop python application that is used by a decent number of 
> folks (I would assume 10k+, though it's hard to know since it's based on 
> number of downloads rather than number of unique users). I would like to 
> integrate some sort of usage tracking that would enable me to determine 
> number of users along with startups, which features are used/not used, 
> performance metrics, exceptions, etc. Since it's an open-source project, I am 
> looking for a free service (or a service that provides free licenses to open 
> source projects) that has a python client library. 
> 

You do know, of course, that most folks frown on applications that “phone home” 
without asking first, and if you do ask your users for permission, many of them 
(perhaps most) will say no.  So, you still won’t really have good statistics.

Bill

> Can anyone recommend something?
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: closing image automatically in for loop , python

2017-04-12 Thread William Ray Wing

> On Apr 12, 2017, at 7:18 AM, Masoud Afshari  wrote:
> 
> Dear all
> 
> I have several *.sfd files which created by a simulation code. I wrote a 
> program containing a for Loop which reads  each time one .sfd file  and plot 
> the requested Parameters. I have two request:
> 
> 1- my Problem is that for Showing successive Images in for Loop I have to 
> Close the Image MANAULLY each time to read next sdf file. can anyone please 
> tell me which command do I have to use so the code Close the Images 
> automatically.
> 

I normally run matplolib in interactive mode, so this may not be quite correct, 
BUT I think you only need to add a call to:

close()

After your call to plt.show()

Bill


> 2- more over, can anyone please tell me how can I create a movie with this 
> code.
> 
> in the following you can see my code
> 
> 
> #
> # in this program, PYTHON reads the reduced files and plot the variables .
>  
>  
> import sys 
> import sdf
> import numpy as np
> import matplotlib.pyplot as plt 
> from matplotlib.font_manager import FontProperties
> fp = FontProperties('Symbola')
>  
> # information from EPOCH input.deck
> nx,ny= 1200, 1600
>  
> xmin=-100e-6
> xmax = 50e-6
> ymin = -100e-6
> ymax = 100e-6
>  
> X =np.linspace(xmin,xmax,nx) #Generate linearly spaced vector. The spacing 
> between the points is (x2-x1)/(n-1).
> Y =np.linspace(ymin,ymax,ny)
>  
> #
> for n in range(0,27):
> nstr = str(n)#.zfill(4)
> #print nstr
>  
> ##
> fig = plt.figure() #plot several figures simultaneously 
> 
> . reading Ex
>  
> filename ="Ex_resample" +'_sdf_'+ str(n)+'.dat'
> with open(filename, 'rb') as f: #read binary file
> data = np.fromfile(f, dtype='float64', count=nx*ny) #float64 for Double 
> precision float numbers
> Ex = np.reshape(data, [ny, nx], order='F')
> #print Ex.max()
>  
> #Display image with scaled colors:
> plt.subplot(222)
> fig1=plt.imshow(Ex, extent=[X.min()*1e6, X.max()*1e6, Y.min()*1e6, 
> Y.max()*1e6], vmin=0, vmax=2e12, cmap='brg', aspect='auto') #cmap='jet', 
> 'nipy_spectral','hot','gist_ncar'
> #plt.suptitle('Ex')
> plt.title('sdf '+ str(n)+ '; Time= ' +str(n*50)+ 'ps',color='green', 
> fontsize=15)
> plt.xlabel('x($\mu$m)')
> plt.ylabel('y($\mu$m)')
> plt.text(40,80,'Ex',color='red', fontsize=15)
> plt.colorbar()
> plt.show()
> #fig.savefig('test.jpg')
> sys.exit()
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and the need for speed

2017-04-10 Thread William Ray Wing

> On Apr 10, 2017, at 8:25 AM, Mikhail V  wrote:
> 
> On 10 April 2017 at 02:21, Gregory Ewing  wrote:
>> 
>> 
>> 
>> My take on the idea of making Python less dynamic in order
>> to improve speed is that you'll end up with a language that,
>> while it may superficially resemble Python, doesn't
>> really feel like Python.
>> 
>> Boo is an example of that. It has a Python-like syntax, but
>> to get any speed advantage you need to add static type
>> delarations, and then it feels more like programming in
>> C# than Python. At that point, you wonder whether you might
>> just be better off writing your program in C# to begin with.
>> 
>> That's not to say this kind of approach isn't worth pursuing,
>> but like the JIT attempts mentioned in the article, it has
>> also been tried before, with varying levels of success.
> 
> Agree. python is python and I suppose that performance issues
> has much to do with types and OOP.
> When I first started with python I thought - no, it is not possible
> without types, if I'll write something more complicated than
> hello world, it will all break at some point.
> But hell, this works and works good.
> 
> Still I miss some old school features in Python, e.g. "goto" statement would
> be very useful in some cases. I know it is considered bad style
> to use goto, but in some cases it is just most natural thing to use.
> 
> What I am (and probably many people) missing is a good tool for
> performance middle- and low-level applications.
> For me it would be a coding tool, sort of minimalist IDE, with simple
> readable syntax which generates compilable C code.
> And it would not be necessarily python-like syntax,
> but I tend to agree that for today python's syntax is
> most readable.

Have you considered Swift, now that it is open source?

Bill

> 
> The problem that many are overlooking still is that the
> possibilities for syntaxes are very limited in pure text-mode
> presentation.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Who are the "spacists"?

2017-03-17 Thread William Ray Wing

> On Mar 17, 2017, at 8:52 PM, Mikhail V  wrote:
> 
> So Python supports both spaces and tabs for indentation.
> 
> I just wonder, why not forbid spaces in the beginning of lines?
> How would one come to the idea to use spaces for indentation at all?
> 

That convention dates all the way back to the IBM 026 and 029 card punches and 
FORTRAN.

> Space is not even a control/format character, but a word separator.
> And when editors will be proportional font based, indenting with
> spaces will not make *any* sense so they are just annoyance.
> Neither makes it sense in general case of text editing.
> I think it would be a salvation to forbid spaces for indentation,
> did such attemps take place?
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Context

2017-02-03 Thread William Ray Wing

> On Feb 3, 2017, at 8:10 AM, Antonio  wrote:
> 
> From: Antonio
> Sent: Friday, February 3, 2017 1:02 PM
> To: python-list@python.org
> Subject: Context
> 
> I have python version 3.6.0 installed into my desktop)windows 7) but the 
> menu/context (file,edit..etc) is missing.
> 
> How to fix this problem?
> 

python, is not a GUI program, it doesn’t have a menu of actions.  If you want 
to surround python with a GUI you would have to install any of several IDEs 
(Integrated Development Environments) which will let you create python 
programs, edit them, and test them interactively.  Not being a Windows user, I 
shouldn't recommend any particular one.

Bill

> 
> Thanks
> 
> 
> Antonio
> 
> 
>  
> [cid:36574bcd-0958-41f0-a1b3-2c34586b236a]
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Choosing a Python IDE. what is your Pythonish recommendation? I do

2017-01-06 Thread William Ray Wing

> On Jan 4, 2017, at 3:44 PM, Dietmar Schwertberger <maill...@schwertberger.de>
wrote:
>
> On 04.01.2017 15:41, William Ray Wing wrote:
>> I use Wing, and I think you will like it.  It *is* pythonic, and for what it
is worth, offers remote debugging as one of its more recently added features.
> Obviously, you had no other choice than using Wing ;-)

I should have said something.  First, and to the best of my knowledge, I have 
no relationship with the Wing developers other than being a satisfied customer. 
Second, seven years ago, when I was reading IDE reviews and testing the more 
highly rated products, Wing just bubbled up to the top of the sieve I was using 
(features, ease of use, and the way it fit my idea of â £naturalâ Ø, pretty 
much everyone's standard list).

>
> The remote debugging has been around for some years. I have been using it
quite often to debug on my Raspberry Pi, Nokia N900 and Jolla Phone, all 
running some Linux system. It works well. It is or was a bit complicated to set 
up. I think this has been improved with Wing 6, but I did not need it in the 
last weeks, so I don't know.

They claim it has been, but like you, I havenâ Öt had need to test it on the 
new release.

Thanks,
Bill

>
> Regards,
>
> Dietmar
> --
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Choosing a Python IDE. what is your Pythonish recommendation? I do

2017-01-06 Thread William Ray Wing

> On Jan 4, 2017, at 1:54 AM, Antonio Caminero Garcia 
wrote:
>
> On Tuesday, January 3, 2017 at 4:12:34 PM UTC-8, Dietmar Schwertberger wrote:
>> On 02.01.2017 12:38, Antonio Caminero Garcia wrote:
>> You did not try Wing IDE? It looks less like a spacecraft. Maybe you
>> like it.
>> Maybe the difference is that Wing is from Python people while the ones
>> you listed are from Java people.
>
> That sounds interesting. By the look of it I think I am going to give it a
try.
>
>

[byte]


> I want editor with those IDE capabilities and git integration, with
optionally  cool stuff as for example remote debugging.

I use Wing, and I think you will like it.  It *is* pythonic, and for what it is 
worth, offers remote debugging as one of its more recently added features.

-Bill

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


Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread William Ray Wing

> On Jan 4, 2017, at 3:44 PM, Dietmar Schwertberger <maill...@schwertberger.de> 
> wrote:
> 
> On 04.01.2017 15:41, William Ray Wing wrote:
>> I use Wing, and I think you will like it.  It *is* pythonic, and for what it 
>> is worth, offers remote debugging as one of its more recently added features.
> Obviously, you had no other choice than using Wing ;-)

I should have said something.  First, and to the best of my knowledge, I have 
no relationship with the Wing developers other than being a satisfied customer. 
Second, seven years ago, when I was reading IDE reviews and testing the more 
highly rated products, Wing just bubbled up to the top of the sieve I was using 
(features, ease of use, and the way it fit my idea of “natural”, pretty much 
everyone's standard list).

> 
> The remote debugging has been around for some years. I have been using it 
> quite often to debug on my Raspberry Pi, Nokia N900 and Jolla Phone, all 
> running some Linux system. It works well. It is or was a bit complicated to 
> set up. I think this has been improved with Wing 6, but I did not need it in 
> the last weeks, so I don't know.

They claim it has been, but like you, I haven’t had need to test it on the new 
release.

Thanks,
Bill

> 
> Regards,
> 
> Dietmar
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread William Ray Wing

> On Jan 4, 2017, at 1:54 AM, Antonio Caminero Garcia  
> wrote:
> 
> On Tuesday, January 3, 2017 at 4:12:34 PM UTC-8, Dietmar Schwertberger wrote:
>> On 02.01.2017 12:38, Antonio Caminero Garcia wrote:
>> You did not try Wing IDE? It looks less like a spacecraft. Maybe you 
>> like it.
>> Maybe the difference is that Wing is from Python people while the ones 
>> you listed are from Java people.
> 
> That sounds interesting. By the look of it I think I am going to give it a 
> try.
> 
> 

[byte]


> I want editor with those IDE capabilities and git integration, with 
> optionally  cool stuff as for example remote debugging. 

I use Wing, and I think you will like it.  It *is* pythonic, and for what it is 
worth, offers remote debugging as one of its more recently added features.

-Bill


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


Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread William Ray Wing

> On Aug 12, 2016, at 7:07 AM, Steven D'Aprano  
> wrote:
> 
> 

[megabyte]

> 
> 
> [1] Are there programming language aware spell checkers? If not, there
> should be.
> 
> 

There are programming language-aware editors with built-in spell checkers (and 
syntax coloring, but that’s a different matter).

-Bill

> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: GoPiGo distence sensor

2016-06-15 Thread William Ray Wing

> On Jun 15, 2016, at 10:59 AM, Joel Goldstick  wrote:
> 
> On Wed, Jun 15, 2016 at 10:15 AM,   wrote:
>> I have a small robot on wheels named the GoPiGo.
>> What I want is if the distence sensor read the same distence for let say 5 
>> seconds then the GoPiGo go's backward.
>> 

When I look at the API, I see two functions related to distance traveled.  An 
encoder target function that presumably reads the numbers from an angular 
encoder on the drive shaft and allows you to specify a number for the encoder 
to seek, and a “us_dist” function that seems to read the proximity to an object 
from an ultrasonic sensor.  I’m going to assume you are referring to the 
numbers from this ultrasonic distance sensor.  So, I think what you are saying 
is that if the numbers from the distance sensor are unchanged for 5 seconds (as 
would be the case if the GoPiGo were being blocked by something) then you want 
it to back up. 

As MRAB has commented, what you need to do is set up a delay loop that wakes up 
every second (or more frequently if you want more time resolution) and reads 
the number returned by the us_dist function.  Compare it to the previous 
reading and if unchanged increment a counter.  If it has changed, the robot has 
moved so clear the counter.  If the counter reaches your five second trigger 
point, call a go_back function you write.

-Bill


>> But I don't now how to program this in python.
>> The Api functions for the GoPiGo are here: 
>> http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-raspberry-pi-gopigo/
>> 
>> Can someone help me with this.
>> 
>> --
>> https://mail.python.org/mailman/listinfo/python-list
> 
> You can start here: https://www.python.org/about/gettingstarted/
> 
> 
> -- 
> Joel Goldstick
> http://joelgoldstick.com/blog
> http://cc-baseballstats.info/stats/birthdays
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: [beginner] What's wrong?

2016-04-01 Thread William Ray Wing

> On Apr 1, 2016, at 6:57 PM, Mark Lawrence via Python-list 
>  wrote:
> 
>> On 01/04/2016 23:44, sohcahto...@gmail.com wrote:
>>> On Friday, April 1, 2016 at 3:10:51 PM UTC-7, Michael Okuntsov wrote:
>>> Nevermind. for j in range(1,8) should be for j in range(8).
>> 
>> I can't tell you how many times I've gotten bit in the ass with that 
>> off-by-one mistake whenever I use a range that doesn't start at zero.
>> 
>> I know that if I want to loop 10 times and I either want to start at zero or 
>> just don't care about the actual number, I use `for i in range(10)`.  But if 
>> I want to loop from 10 to 20, my first instinct is to write `for i in 
>> range(10, 20)`, and then I'm left figuring out why my loop isn't executing 
>> the last step.
> 
> "First instinct"?  "I expected"?  The Python docs might not be perfect, but 
> they were certainly adequate enough to get me going 15 years ago, and since 
> then they've improved.  So where is the problem, other than failure to RTFM?
> 
I've always found it vaguely amusing that the server(s) for just about all the 
technical info at MIT reside behind http://rtfm.mit.edu

Bill

> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-03 Thread William Ray Wing

> On Mar 3, 2016, at 3:20 PM, alister  wrote:
> 
> On Thu, 03 Mar 2016 11:03:55 -0700, Ian Kelly wrote:
> 
>> On Thu, Mar 3, 2016 at 10:21 AM, alister 
>> wrote:
>>> On Thu, 03 Mar 2016 13:35:12 +1100, Chris Angelico wrote:
 1) No physical object can have negative mass.
 2) I am a part of the universe and have positive mass.
 3) I am not Kenneth.
 4) The sum of my mass and Kenneth's mass must exceed Kenneth's mass
 alone.
 
 Unless someone wants to dispute 1 or 2, we can be logically certain.
 
 ChrisA
>>> 
>>> Anti Matter?
>> 
>> Antimatter has positive mass.
> 
> Are you sure?

The ALPHA experiment at CERN is attempting a direct measurement of the mass of 
anti-hydrogen by trapping atoms of the stuff in a penning trap at high vacuum. 
The answer isn’t definitive yet as the error bars are huge and extend past 
zero, but are centered on the positive side.

-Bill


> mix 1 atom of hydrogen + 1 of anti hydrogen & you end up with 0 mass (+ 
> LOTTS of energy)
> 
> To be honest it is all over my head
> 
> 
> 
> -- 
> I used to be Snow White, but I drifted.
>   -- Mae West
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-19 Thread William Ray Wing

> On Feb 19, 2016, at 8:13 PM, Steven D'Aprano  wrote:
> 
> On Sat, 20 Feb 2016 12:27 am, Dennis Lee Bieber wrote:
> 
> 
>> Then the best suggestion I have would be to take a weekend and just
>> read the language reference manual (it used to be about an 80-page PDF
>> file, but has no doubt grown into some less handy dynamically linked
>> HTML/"help" file). Then add the section of the library reference manual
>> that discusses data types. And while in that manual, scan the table of
>> contents -- you may find there are modules in the standard library that
>> already do what you need.
> 
> Surely you should start with the tutorial, not the reference manual.
> 
> 
> 
> -- 
> Steven
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

Plus +1.  The ref manual would be like learning English from a dictionary

Bill

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


Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-18 Thread William Ray Wing

> On Feb 18, 2016, at 10:33 AM, wrong.addres...@gmail.com wrote:
> 
> torstai 18. helmikuuta 2016 17.21.32 UTC+2 Oscar Benjamin kirjoitti:
>> On 18 February 2016 at 11:32, Chris Angelico  wrote:
>> 

[byte]

>> It sounds to me as if all of your needs can be solved in pure Python
>> code possibly using some of the popular extension modules from PyPI.
>> In this case it's actually very easy to package/install. You can
>> package your code simply by zipping it up with a __main__.py file.
>> Someone who wants to install it will simply have a two step process:
>> first install Python (and possibly a few dependencies) and then obtain
>> the zip file with your code in it.
>> 
>> --
>> Oscar
> 
> This form of packing is not desirable. I can't ask other people to install 
> Python on their machines, and I also would not want show most of the code 
> doing the calculations.
> 

Now things get tricky.  I can understand you not wanting to force people to 
pre-install Python in order for your code to run, but just how deeply do you 
want to hide or obfuscate it?  Is this potentially a commercial application to 
be sold, or are you simply trying to keep things clean and tidy within various 
divisions of your company.  I’d hope not the former, because even VB can get 
you into tricky licensing issues (and in any case - even fully compiled code in 
any language these days can be de-compiled into logically correct source code, 
although with less than obvious variable names).  At the other extreme, there 
are packaging programs (py2exe comes to mind, although I have no experience 
with it).  These wrap the whole python interpreter, your code, and any needed 
libraries into an executable (clickable) package.  Their only downside is that 
the output packages they produce tend to be large.  However, any sophisticated 
user who digs into them WILL be able to find your source code, possibly only 
slightly obfuscated by being zipped.

> Another question I have is regarding reading numerical data from text files. 
> Is it necessary to read one character at a time, or can one read like in 
> Fortran and Basic (something like Input #5, X1, X2, X3)?

Python can read lines of text or whole blocks of text from source files.  If 
those files are in more or less well-understood form (csv for example) it has 
libraries specifically designed for reading and extracting data from them 
(including VERY nice facilities for doing arithmetic and otherwise manipulating 
time and date data).

Bill

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

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


Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-18 Thread William Ray Wing

> On Feb 17, 2016, at 2:49 PM, wrong.addres...@gmail.com wrote:
> 
> I am mostly getting positive feedback for Python.
> 
> It seems Python is used more for web based applications. Is it equally fine 
> for creating stand-alone *.exe's? Can the same code be compiled to run on 
> Linux or Android or web-based?
> 
> Is it possible to create GUI elements with a good IDE? Can they be defined 
> like in Visual Basic with given sizes, fonts, visible/invisible, etc.?
> 
> Is it easy to do matrix operations in Python? Or do I need to write 
> subroutines like in Visual Basic?
> 
> Could someone kindly tell me advantages and disadvantages of Python? Or any 
> better options? I have like 40-50 VB Forms and may be around 2 lines of 
> code. It will be a task to learn a new language and translate/re-write that 
> code.
> 

At this point you’ve probably heard more than you wanted to *about* Python.  
The next step really ought to be simply to invest a few minutes in looking at 
the language itself.
Start here by downloading a copy of the Python interpreter:

https://www.python.org/downloads/windows/

Then, there is an extensive list of on-line tutorial material here:

https://wiki.python.org/moin/BeginnersGuide/Programmers

I’d recommend simply picking one and diving in. If you have questions (and you 
surely will), come back here or, at least initially, send them to the Python 
Tutor list (tu...@python.org).

Good luck and have fun,
Bill


> Thanks for your responses. 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-17 Thread William Ray Wing

> On Feb 17, 2016, at 2:49 PM, wrong.addres...@gmail.com wrote:
> 
> I am mostly getting positive feedback for Python.
> 

I would be surprised if you weren’t.

> It seems Python is used more for web based applications. Is it equally fine 
> for creating stand-alone *.exe's? Can the same code be compiled to run on 
> Linux or Android or web-based?
> 

I’m not sure where you got that idea.  Python has been and is being used for an 
extremely broad range of applications.  At one extreme, the popular YouTube 
site is based on Python (and yes, that is a web application), at the other 
extreme much (most?) of the data analysis of the recent LIGO data leading up to 
the discovery of gravitational waves was done in Python, and numpy (a python 
numerical library); with the results displayed in matplotlib (a python library 
for scientific-engineering graphics).

The basic python language and its libraries are completely cross-platform 
(Linux, OS-X, Windows, iOS, and Android).  The same source code will run on all 
of them.  However, because it is an Interpreted language, the step to a 
bundled, self-contained image is platform dependent. There python compliers (as 
opposed to interpreters) for some, but not all platforms, and there is a very 
active JiT compiler project that would fall somewhere in between. 

> Is it possible to create GUI elements with a good IDE? Can they be defined 
> like in Visual Basic with given sizes, fonts, visible/invisible, etc.?
> 

There are several GUI libraries for Python.  You might check out TK (which 
comes built-in), but there are also libraries like wxPython, Kivi (which is 
completely cross platform), and PyQt.  Note that these are the GUI libraries 
themselves, not IDE’s which tend to be independent.  There are too many IDE’s 
to list here - check with Google.

> Is it easy to do matrix operations in Python? Or do I need to write 
> subroutines like in Visual Basic?

Matrix (and similar operations) can be done in Python directly, but if you need 
maximum performance you should use the optimized vector routines available in 
numpy, these are typically pre-compiled with C or FORTRAN and squeeze out the 
maximum speed your hardware is capable of.  (There is work being done to 
migrate them to GPUs, but is VERY hardware dependent at this point.) If you 
need to do scientific/engineering analysis, you should also check out scipy, 
which is built on top of it and is also vector optimized.

> 
> Could someone kindly tell me advantages and disadvantages of Python?

If you are completely satisfied with VB, there is no reason to change (other 
than the enjoyable exercise of learning a new and more powerful language).

On the other hand, Python has often been referred to as “executable pseudo 
code” - in other words, the english-like steps you might sketch out to outline 
the solution to a programming problem in another language is to all intents and 
purposes Python itself.  This makes for very fast and productive code 
generation with typically fewer errors than are made in other languages. In 
addition, and as has been implied above, it is cross platform.  The same python 
source code (with the appropriate libraries) will run on all the platforms 
mentioned above. One of the biggest productive features of Python is the fact 
that it is interpreted (in its most common instantiation).  Thus, you can have 
two windows open side by side, with the source code in one and running code in 
the other.  Changes in the source code can instantly be reflected in the output.

> Or any better options? I have like 40-50 VB Forms and may be around 2 
> lines of code. It will be a task to learn a new language and 
> translate/re-write that code.
> 

Not necessarily better, but at least worth looking into would be the Swift 
language, which shares much of Python’s modern structure, is now also open 
source, and has been ported to most flavors of Linux.  A Window’s port is 
promised, but I don’t know how far along it is.  It *is* a compiled language, 
so you would then be back in the edit, compile, link, and run loop as you debug 
your code.

I’m sure you will get lots of other answers - Google each of the things I’ve 
mentioned and you will get a truck-load of info.  You might start with 
Wikipedia and read there about Python and Swift.

> Thanks for your responses. 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Stop writing Python 4 incompatible code

2016-01-16 Thread William Ray Wing

> On Jan 16, 2016, at 9:48 AM, Bernardo Sulzbach  
> wrote:
> 
> On Sat, Jan 16, 2016 at 12:41 PM, Alister  wrote:
>> it was exactly the scenario described
>> 
>> A company had developed a means of impo=roving the Fat file system (IIRC by
>> using a pseudo file system on top to eliminate the wasted space caused by
>> incomplete blocks & the end of files)
>> 
>> Microsoft engaged in negotiations to include the technique in MSDOS
>> the pulled out at the last minute (after obtaining all the technical
>> details) & introduced their own version which operated almost identically.
>> 
>> heck PCDos was initially written by a 3rd party who was ripped of by
>> Microsoft.
>> 
>> Microsoft are the goto example fro the three 'E' approach to development.
>> 
>> Embrace
>> Extend
>> Extinguish
> 
> Did people know this back then or it just surfaced years later?

It was known at the time. It was certainly known by the companies that were 
ripped off, but they were typically small to really small and couldn’t get 
traction for their stories in a press that was in thrall to Micro$oft.  It was 
pretty much only mentioned by contrarian writers like Cringely, and for the 
most part was lost in the noise over the browser war.

Bill

> I
> suppose that at the beginning MS was more "vulnerable" than it is
> today.
> 
> -- 
> Bernardo Sulzbach
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Stop writing Python 4 incompatible code

2016-01-15 Thread William Ray Wing

> On Jan 15, 2016, at 9:52 AM, Emile van Sebille  wrote:
> 
> On 1/14/2016 3:55 PM, Rick Johnson wrote:
>> But, when you have almost infinitely deep pockets, like
>> Google, you don't need to create *everything* yourself, no,
>> you simply wait for someone else to build it, then wait a
>> little longer for them to market it successfully, and when
>> it's jt starting to turn a profit, you swoop in,
>> purchase it, and then you drive that "money train" at full
>> speed until its wheels fall off!
>> 
>> And if the owners refuse to sell, no problem, you offer
>> their customers the same services at bargain basement
>> discounts -- then they'll have no choice but to sell, or
>> face bankruptcy. Yep, just another tactic of economic
>> warfare.
> 
> Hmm, sounds like they're stealing plays from Micro$oft.
> 
> Emile
> 

What Micro$oft was actually sued for was worse.  They would approach a small 
company: “We like your product/technology, we think we are interested in buying 
you out, but we want to see your code to be sure it is 
modular/well-documented/etc.”  Then, after looking over the code: “Well, it 
actually doesn’t fit our plans.  Sorry.”  Six months or so later, essentially 
identical stuff would turn up in a Micro$soft product.

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


Re: Stop writing Python 4 incompatible code

2016-01-15 Thread William Ray Wing

> On Jan 15, 2016, at 1:09 PM, Bernardo Sulzbach <mafagafogiga...@gmail.com> 
> wrote:
> 
> On Fri, Jan 15, 2016 at 3:02 PM, William Ray Wing <w...@mac.com> wrote:
>> 
>> What Micro$oft was actually sued for was worse.  They would approach a small 
>> company: “We like your product/technology, we think we are interested in 
>> buying you out, but we want to see your code to be sure it is 
>> modular/well-documented/etc.”  Then, after looking over the code: “Well, it 
>> actually doesn’t fit our plans.  Sorry.”  Six months or so later, 
>> essentially identical stuff would turn up in a Micro$soft product.
>> 
> 
> More out of curiosity than anything else, do you have a source?
> 
> -- 
> Bernardo Sulzbach
> -- 
> https://mail.python.org/mailman/listinfo/python-list

It came out of a Cringely column several years ago, I don’t remember the date.  
What I do remember (and failed to add to my note before) was that Micro$soft 
counted on the mismatch in legal department sizes to pretty much prevent any 
one small company from suing (or bankrupted them if they tried).  It was 
typically a footnote in the press stories about the government suit and another 
bullet point in the unfair competition/tactics alleged.

Bill



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


Re: imshow keeps crashhing

2016-01-06 Thread William Ray Wing

> On Jan 6, 2016, at 6:10 PM, darren.mcaf...@gmail.com wrote:
> 
> Thanks for the quick reply! 
> 
> So scipy is making temporary files in /private/vars/folders/w4/ name>/

Is this a typo or did you really mean /private/vars?  That is, did your create 
a “vars” directory under /private at some point in the past (pre-Yosemite)?  
The usual directory there would be /var

In any case, the whole /private directory tree is now part of the SIP (System 
Integrity Protection) system under Yosemite, and to open and manipulate files 
there you will have to either turn SIP off or jump through hoops.  If you do a 
ls -al in /private, you will see that var is

drwxr-xr-x 29 root wheel 986 Oct 23 11:20 var

note the “root” and “wheel” owner and group names. I’d suggest moving your 
tests to a different directory that isn’t part of SIP, and debug there. If you 
MUST work under /private, you will have your work cut out for you.

-Bill

> 
> 1. When in the correct folder within Terminal, on the command line I can do: 
>open  
> And it will open it in Preivew.
> 
> 2. However, when opening Preview first, it is impossible (for me) to navigate 
> to the /private directory to open the file that way, even with: 
>defaults write com.apple.Finder AppleShowAllFiles YES
> turned on.
> 
> 3. When I run imshow() (my attempt to 'launch Preview from scipy as you 
> suggested). The UID of the process is 501, which is the same as when I do 
> echo $UID. So I'm assuming the launched Preview is running as myself.
> 
> 4. When the temporary file is originally created its permissions are -rw--
> 
> Does any of that information help? Thanks again.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Mac Question

2016-01-01 Thread William Ray Wing

> On Jan 1, 2016, at 5:56 AM, tdspe...@gmail.com wrote:
> 
> Hi All
> 
> I am trying to create a directory on a windows drive from my macbook air with 
> python but get a permissions error because the windows ntfs drive is read 
> only - does anyone know away to overcome this issue - I have looked for a 
> utility but have yet to find an answer.
> 
> Regards and Happy New Year
> 
> Colin
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

OS-X can read NTFS drives, but by default cannot write to them, hence the 
read-only mount.  If you have control over that external drive you can format 
it (on OS-X) as ExFAT, and it can then be written to and read from by both OS-X 
and Windows.  If the drive must be formatted NTFS, you can turn on writing via 
terminal commands (which works ONLY on a volume-by-volume basis) or using a 
third party utility.  There is a pretty good summary here:

  http://www.cnet.com/news/how-to-manually-enable-ntfs-read-and-write-in-os-x/

-Bill

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


Re: Writing a Financial Services App in Python

2015-11-19 Thread William Ray Wing

> On Nov 19, 2015, at 6:59 AM, Cai Gengyang  wrote:
> 
> 
> From YCombinator's new RFS, This is the problem I want to solve as it is a 
> severe problem I face myself and something I need. I want to write this app 
> in Python as I heard that Python is a great language that many programmers 
> use ... How / where do I start ? The problem is detailed below :
> 
> FINANCIAL SERVICES
> 

[Big edit]

You might enjoy reading the note here:  
http://www.wsj.com/articles/an-algo-and-a-dream-for-day-traders-1439160100?mod=djem10point

Which, among other things, points out that DIY algorithmic trading is the 
latest DIY craze.

Bill


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


Re: What does “grep” stand for?

2015-11-06 Thread William Ray Wing

> On Nov 5, 2015, at 10:36 PM, Larry Hudson via Python-list 
>  wrote:
> 
> On 11/05/2015 05:18 PM, Dennis Lee Bieber wrote:
>> On Thu, 5 Nov 2015 20:19:39 + (UTC), Grant Edwards
>>  declaimed the following:
>> 
>>> Though I used a line-editor for a while on VMS, I was never very good
>>> at it, and abanded it for a full-screen editor at he first
>>> opportunity.  But, if you ever get a chance to watching somebody who
>>> _is_ good at 'ed', it's something you'll remember...
>> 
>>  I didn't convert to EDT until DEC dropped SOS... And then shortly later
>> I keymapped the Blaise ([Alcor] Pascal) editor on the TRS-80 Mod-III to
>> replicate EDT (as much as possible, given only three function keys on the
>> numeric pad)
>> 
>>  The Amiga used to have two standard editors -- a screen editor and a
>> line editor; as I recall the line editor supported a file window, so one
>> could edit large files by making a single direction pass using a smaller
>> window and a script. Later the screen editor gained ARexx support, so one
>> could script it using ARexx. (And by then they also included a form of
>> microEMACS, my C compiler had a look-alike vi editor... and a later C
>> compiler had another editor integrated to the compiler so that error
>> message reports could trigger the editor to open the file and move to the
>> error position)
>> 
> Anyone besides me remember the CP/M editor Mince (Mince Is Not Complete 
> EMACS)?
> It was an emacs-like editor, without any e-Lisp or other way of extending it. 
>  I believe it was my first exposure to a screen-oriented editor.  I quite 
> liked it at that time (but that was a looonnng time ago!)
> 
> -=- Larry -=-
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

You’re not REALLY an old timer unless you’ve used TECO.

-Bill

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


Re: Detection of a specific sound

2015-11-03 Thread William Ray Wing

> On Oct 25, 2015, at 8:17 PM, Montana Burr  wrote:
> 
> I'm looking for a library that will allow Python to listen for the shriek of 
> a smoke alarm. Once it detects this shriek, it is to notify someone. Ideally, 
> specificity can be adjusted for the user's environment. For example, I expect 
> to need moderate specificity as I live in a quiet neighborhood, but an 
> apartment dweller might need more.
> 
> I'm thinking of recording a smoke alarm and having the program try to find 
> the recorded sound in the stream from the microphone.
> 

I’ve been watching this thread and finally decided to jump in.

First off, we REALLY need to know a bit more about what you are trying to 
accomplish, in what sort of environment, and under what constraints (legal and 
otherwise).  That last bit is crucial.  Is this simply a heads up e-mail 
message to be sent or is it a way of notifying a backup (second tier) 
monitoring service.  Is it for your personal use, or do you expect to sell it 
(again crucial).  Does the computer you expect to run this on have a good UPS 
system (in a typical fire, AC power frequently fails early, sometimes it is the 
*cause* of the fire).  How are you going to get that notification out?  Does 
your network have battery backup?  Are you going to buy a station-service cell 
phone transmitter? If you are thinking of sending a cell phone msg, how do you 
guarantee the receiver is on?  LOTS of issues here.  Then, having said that, 
and in no particular order:

1) the sounders in most smoke alarms use over-driven pizeo-electric 
annunciators, their output has a VERY complex frequency spectrum with LOTS of 
harmonics.  Spectral analysis (combined with threshold analysis) MIGHT be a 
good way to go, but doing so in real time with Python would consume most, if 
not all the resources of the host computer;

2) You would (personal opinion), be much better off using hardwired or 
semi-hardwired detection.  There are several ways to go, including a detector 
microphone and transmitter such as is used to run a remote doorbell system 
(mount the microphone next to the smoke detector, then tap into the doorbell 
receiver box). These have adjustable sensitivity and would basically be a 
threshold detector.  Alternatively, almost all smoke detectors these days are 
designed to be chained to each other via three-wire (plus ground) AC wiring.  
Two of the wires carry power, the third triggers all the detectors in the 
system to sound when if of them sound.  Don’t try to tap the signal wire 
(liability issues), but you could add another detector to the system which 
would act as your monitor if you tap *its* driver output.

3) Finally, how do you guarantee the computer on which the program is to run 
will be up at all times?  Does it auto-restart after a power failure, does the 
program auto-reload as part of the boot-up sequence, and finally, is the 
program going to have absolutely bullet proof error recovery?

-Bill





> Any help is greatly appreciated!
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Recover data over the network

2015-10-09 Thread William Ray Wing

> On Oct 9, 2015, at 10:44 PM, Arshpreet Singh  wrote:
> 
>> On Saturday, 10 October 2015 04:40:27 UTC+5:30, Steven D'Aprano  wrote:
>> 
>> What do you mean, "recover data from a server"? What has happened to the
>> server? Can it boot or is it in an unbootable state? Are the hard drives
>> physically damaged? What sort of hard drives? (Solid state, or magnetic
>> media?)
> 
> Server is booting up. We are using SSD. Disk is not physically Damaged. I 
> can't reach to server Physically. 
> 
> 
>> What makes you think this will be a "small" Python application? Do you have
>> limits on the maximum size? (Does the application have to fit on a floppy
>> disk?) Are you expecting a GUI? What OS do you want the application to run
>> on? (Windows, Linux, Mac OS, Android, embedded systems, something else?)
> 
> From the small I was meaning a simple Python command Line application. That I 
> will be able to execute from shell. Server is on Ubuntu Linux.
> 
>>> For the 2nd part I can use scp(secure copy), Please let me know if any
>>> data-recovery library is available in Python to do 1st task.
>> 
>> Depends on what you mean by data recovery.
> 
> My main aim is to recover user accounts mostly data present in /home 
> partition of the disk.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

I hesitate to mention this, but there _may_ be a communication problem here. 
When American-English speakers refer to data recovery, they usually are 
discussing reading data from a disk that has suffered some catastrophic event, 
say a head crash or an inadvertent wholesale data deletion. In either case 
physical access to the hardware is assumed (and required). Based on what you've 
said so far, you don't have physical access, the disk (SSD) is operating 
normally, and you simply want remote read access to the /home directory tree. 
Is this correct?  If the answer is yes, then the discussion will head off in an 
entirely different direction. 

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


Re: Python handles globals badly.

2015-09-09 Thread William Ray Wing

> On Sep 9, 2015, at 1:22 PM, Steven D'Aprano  wrote:
> 
> 

[byte]

> 
> I think my favourite is the guy who claims that the reason natural languages
> all count from 1 is because the Romans failed to invent zero. (What about
> languages that didn't derive from Latin, say, Chinese?)

Right.  Note that the Arabs, who DID invent zero, still count from one.

Bill

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


Re: Need assistance

2015-07-18 Thread William Ray Wing

 On Jul 18, 2015, at 1:34 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 
 

[byte]

 What is an {HP calculator} roll operation?
 

The original Hewlett Packard “Scientific” calculators (HP-35, 45, 65, etc) that 
used Polish notation (operand, operand, operation; with no “=“ sign) had a 
stack.  That stack itself could be manipulated (e.g., interchange X and Y). One 
of the stack manipulation commands was “Roll” which moved the top entry into X 
and pushed remaining elements up one.  Later versions had both Roll-up and 
Roll-down, Roll-down moved the X entry to the top of the stack and dropped the 
other elements.

Bill  (Who still uses an HP-45 emulator on his iPhone)

 -- 
 My fellow Pythonistas, ask not what our language can do for you, ask
 what you can do for our language.
 
 Mark Lawrence
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Fixing Python install on the Mac after running 'CleanMyMac'

2015-05-29 Thread William Ray Wing

 On May 29, 2015, at 9:12 AM, Cem Karan cfkar...@gmail.com wrote:
 
 
 On May 28, 2015, at 11:47 PM, Laura Creighton l...@openend.se wrote:
 
 webmas...@python.org just got some mail from some poor embarrased
 soul who ran this program and broke their Python install.
 
 They are running Mac OSX 10.7.5
 
 They are getting:
 
Utility has encountered a fatal error, and will now terminate.  A
Python runtime could not be located. You may need to install a
framework build of Python or edit the PyRuntimeLocations array in this
applications info.plist file.  Then there are two oblong circles. One
says Open Console. The other says Terminate.
 
 So https://docs.python.org/2/using/mac.html says:
 
  The Apple-provided build of Python is installed in
  /System/Library/Frameworks/Python.framework and /usr/bin/python,
  respectively. You should never modify or delete these, as they are
  Apple-controlled and are used by Apple- or third-party software.
 
 So, I assume this poor soul has done precisely that.
 
 What do I tell her to do now?

As a minor addendum - you can point out that “Clean My Mac” is a well-known 
piece of crap-ware that is so badly written as to be labeled by most people as 
malware.  Best possible solution would be a clean boot and restore from a 
recent clone (either CarbonCopy Cloner or SuperDuper) followed by a restore of 
intervening files from Time Machine.  Failing that, Cem’s suggestions are good.

-Bill

 
 Does she have a recent Time Machine backup that she can restore from?  
 Otherwise the solutions are all fairly painful:
 
 1) Install Python 2.7 from scratch (easy).  Then figure out where to put 
 symlinks that point back to the install (mildly annoying/hard).  Note that 
 Python 3 won't work; none of the built-in scripts expect it.
 
 2) OS X recovery - 
 http://www.macworld.co.uk/how-to/mac/how-reinstall-mac-os-x-using-internet-recovery-3593641/
  I've never had to do that, so I have no idea how easy/reliable it is.  I 
 **think** its supposed to save all the data on the drive, but again, I've not 
 done this, so I can't make any guarantees.
 
 3) Wipe it clean and reinstall from scratch.
 
 Honestly, I hope she has a time machine backup.  I've had to do recoveries a 
 couple of times, and it can really save you.
 
 Good luck,
 Cem Karan
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Accessing DataSocket Server with Python

2015-05-29 Thread William Ray Wing

 On May 28, 2015, at 6:17 PM, Dan Stromberg drsali...@gmail.com wrote:
 
 I have no idea about the protocol used by NI DataSockets, but you
 might be able to reverse engineer the protocol by using the official
 client with a sniffer.
 
 Also, be aware that TCP/IP guarantees that you get the correct data in
 the correct order, but it doesn't guarantee anything about the sizes
 of the chunks in which that data arrives.  So you could send 100
 bytes, 100 bytes, 100 bytes, but on the other end receive 100 bytes,
 50 bytes, 75 bytes, 75 bytes.  When you catenate them all together,
 it's still the same data though.
 
 HTH.
 
 On Wed, May 27, 2015 at 4:30 AM, Garrone, Corrado

While that’s certainly possible in a routed network (and even then can be 
overridden with the “do not fragment” bit), it won’t happen in a LAN or 
self-contained instrument set-up.  These days, even routed networks tend to 
deliver anything less than a 1500 byte packet as a single entity.  With fiber 
backbones and high-speed LANs, it is more work for a router to fragment a 
packet then to simply pass it on.  The days of 480 byte packets pretty much 
went away with dial-up modems.

Bill



 corrado.garr...@roche.com wrote:
 Dear Python Team,
 
 currently I am working on a research project for my bachelor degree. A
 LabVIEW application is used for current and power measurements, whereas the
 measured data are sent to DataSocket Server, a technology by National
 Instruments used for data exchange between computers and applications.
 DataSocket is based on TCP/IP and thus requesting data from DataSocket
 should be similar to an internet request.
 I know with the socket library in Python it is possible with to establish
 sockets, send internet requests and communicate between clients and servers.
 Is there a possibility to access NI DataSocket and get measurement data with
 Python on the same computer where Python is installed and the codes are
 executed? Can you maybe send me an example code where such a connection with
 DataSocket is established?
 
 If you got any queries, please do not hesitate to contact me.
 
 Thank you very much for your efforts.
 
 Kind regards,
 
 Corrado Garrone
 DH-Student Fachrichtung Elektrotechnik / Co-op Student B.Eng. Electrical
 Engineering
 
 Roche Diagnostics GmbH
 DFGHMV8Y6164
 Sandhofer Strasse 116
 68305 Mannheim / Germany
 
 Phone: apprentice
 mailto:corrado.garr...@roche.com
 
 Roche Diagnostics GmbH
 Sandhofer Straße 116; D‑68305 Mannheim; Telefon +49‑621‑759‑0; Telefax
 +49‑621‑759‑2890
 Sitz der Gesellschaft: Mannheim - Registergericht: AG Mannheim HRB 3962 -
 Geschäftsführung: Dr. Ursula Redeker, Sprecherin; Edgar Vieth -
 Aufsichtsratsvorsitzender: Dr. Severin Schwan
 
 Confidentiality Note
 This message is intended only for the use of the named recipient(s) and may
 contain confidential and/or privileged information. If you are not the
 intended recipient, please contact the sender and delete the message. Any
 unauthorized use of the information contained in this message is prohibited.
 
 
 --
 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: New to Python - block grouping (spaces)

2015-04-16 Thread William Ray Wing

 On Apr 16, 2015, at 2:11 AM, Paul Rubin no.email@nospam.invalid wrote:
 
 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
 I'm aware that Coffeescript provides a brace-free wrapper around Javascript; 
 I'm not aware of any wrapper that *adds* braces to a language without them. 
 
 You're not old enough to remember Ratfor ;-)
 -- 
 https://mail.python.org/mailman/listinfo/python-list

HO Boy - Rational FORTRAN!  Right up there with WatFOR (Waterloo FORTRAN for 
you youngsters).  It was interpreted FORTRAN.  Used teaching new programmers 
back in the day because it kept them from crashing the system.

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


Re: ANN: Wing IDE 5.1.2 released

2015-02-26 Thread William Ray Wing

 On Feb 26, 2015, at 2:04 PM, Jim Mooney cybervigila...@gmail.com wrote:
 
 Hey, can I run Py 2.7 and 3.4 side by side without a lot of hassle, using 
 Wing? I run both since I'm migranting and so far the free IDEs just seem to 
 choke on that.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

I assume you just mean that you would like to have different Python projects 
that open in Wing with the correct associated version of Python.
Yes, you can specify a python executable in the Project Properties - 
Environment tab.  Click on the “Custom button in the Python Executable entry 
and enter the path to the version of Python you want. 

If this isn’t what you are after, let us know.

-Bill

PS: I’ve found that the Wing e-mail support is VERY responsive.  No relation, 
just a happy user.

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


Re: python 2 to python 3

2015-02-25 Thread William Ray Wing

 On Feb 24, 2015, at 9:55 PM, Audrey McFarlane bryceod...@icloud.com wrote:
 
 I am using Wing101 v.5 and it is using Python2, but I want to make it use 
 Python3 instead because  need Python3 for a uni lab.  How do I change it?
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Assuming you have Python3 installed on your system. The most straightforward 
way to make Wing use it is to go to the Project menu, select Project 
Properties, and under the Environment tab, Python Executable, click the custom 
button, then enter the path to the Python3 executable in the path window.

Have fun,
Bill

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


Re: python traceroute

2015-01-21 Thread William Ray Wing

 On Jan 21, 2015, at 12:06 AM, Denis McMahon denismfmcma...@gmail.com wrote:
 
 On Tue, 20 Jan 2015 19:37:26 -0800, Chandrakant Tiwari wrote:
 
 in the program below i want it to make it work  the same way as TRACERT 
 command.
 
 As an observation, you're re-inventing a wheel that already works 
 perfectly well, in that any failings of tracert tend to be more down to 
 the way routers are configured to handle icmp than the tracert 
 application itself. Unless you're doing this purely as an exercise in 
 socket programming with python, it might be better to find a new problem 
 to solve.
 
 -- 
 Denis McMahon, denismfmcma...@gmail.com
 -- 
 https://mail.python.org/mailman/listinfo/python-list

I’d further add that as a security measure these days, many (soon to be most) 
hosts are configured to throw icmp packets away without acknowledging them in 
any way.

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


Re: Run Programming ?????

2014-12-12 Thread William Ray Wing

 On Dec 12, 2014, at 8:03 AM, Chris Warrick kwpol...@gmail.com wrote:
 
 
 On Dec 12, 2014 1:40 PM, Delgado Motto riskyay...@gmail.com 
 mailto:riskyay...@gmail.com wrote:
 
  I travel alot, if not just interested in things of pocketable portability, 
  and was curious if you can tell me if Python can be LEARNED from beginner 
  on an IOS device ( with interest of being able to test my code, possibly 
  even if a free website is capable of reviewing scripts ) but if not then I 
  prefer if you can suggest a language that can be used from such a machine. 
  My ultimate goal is to be able to create web pages and internet bots 
  capable of searching specific things for me, simply to save me time in my 
  day as little as crawling Youtube for a song that fails to be uploaded or 
  other related examples. Please advise me. Thanks.  
  --
  https://mail.python.org/mailman/listinfo/python-list 
  https://mail.python.org/mailman/listinfo/python-list
 
 
 Get a real computer. An iOS device won't work, unless you care to buy a vps, 
 use ssh and can stand the onscreen keyboard. It's easier to buy a notebook.
 
 -- 
 Chris Warrick https://chriswarrick.com/ https://chriswarrick.com/
 Sent from my Galaxy S3.
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Second the motion.  Apple’s sandbox policies on iOS devices mean that while you 
can run Python on them (there are several versions available), the sandbox  
pretty much guarantees that at some point you will need a library you can’t 
import, and you won’t be able to test your web pages as you go.

A MacBook Air is within a fraction of being as portable as an iPad, and can 
easily do everything you want.  If you are currently traveling with an iPad, 
you _might_ even discover you prefer traveling with the MacBook.

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


Re: Do you like the current design of python.org?

2014-12-05 Thread William Ray Wing

 On Dec 5, 2014, at 5:43 AM, Steven D'Aprano 
 steve+comp.lang.pyt...@pearwood.info wrote:
 
 Peter Otten wrote:
 
 Did you ever hit the Socialize button? Are you eager to see the latest
 tweets when you are reading a PEP? Do you run away screaming from a page
 where nothing moves without you hitting a button? Do you appreciate the
 choice between ten or so links to the documentation?
 
 I dislike the new design of python.org.
 
 The formatting of long text essays get completely mangled towards the bottom
 of the page, e.g.:
 
 https://www.python.org/download/releases/2.2/descrintro

I’m not sure what you are referring to here.  That page looks fine all the way 
to the bottom of the footer on my system, looking at it with either Firefox or 
Safari.

-Bill

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


Re: Python handles globals badly.

2014-12-04 Thread William Ray Wing

 On Dec 4, 2014, at 8:56 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 
 On Thu, 04 Dec 2014 14:51:14 +0200, Marko Rauhamaa ma...@pacujo.net
 declaimed the following:
 
 Chris Angelico ros...@gmail.com:
 
 A lot of programs don't use threads, and therefore cannot have thread
 safety problems - or, looking at it the other way, do not care about
 thread safetiness. It's like having Neil Armstrong wear water wings to
 make sure he won't drown in the Sea of Tranquility.
 
 The water wings would be too unwieldy since they'd have to be six times
 as large on the moon. It's all about risk/benefit analysis.
 
   Actually, since the pull of gravity is 1/6th that of earth, but the
 density of the water is the Sea is the same, the water wings should be
 smaller to provide the same degree of lift.
 
   Of course, the lack of atmospheric pressure is going to result in the
 water wings expanding, perhaps to the bursting point...
 -- 
   Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Wrong, again I’m afraid.  Assume for a moment you are under a dome pressurized 
to one standard atmosphere in some future moon colony and are in a swimming 
pool.  Both you AND the water are under 1/6th as much gravitational pull.  
Neither your density nor the water’s density has changed. Density is a function 
of the atomic weight of the elements making up both you and the water and the 
inter-atomic/molecular spacing of those elements.  Neither has changed.  
Therefore the volume of buoyant material (in the case of water wings, air) 
necessary to keep you above water is the same on earth as it would be on the 
moon.  

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


Re: Understanding help command description syntax - explanation needed

2014-11-07 Thread William Ray Wing
On Nov 7, 2014, at 7:42 AM, Dave Angel da...@davea.name wrote:
 
 Bob Martin bob.mar...@excite.com Wrote in message:
 in 730867 20141107 093651 c...@isbd.net wrote:
 Darren Chen ccylily1...@gmail.com wrote:
 在 
 2014年11月5日星期三UTC+8下午8时17分11秒,larry@gmail.com写道:
 On Wed, Nov 5, 2014 at 7:13 AM, Ivan Evstegneev webmailgro...@gmail.com 
 wrote:
 Firtst of all thanks for reply.
 
 brackets [] means that the argument is optional.
 
 That's what I'm talking about (asking actually), where do you know it 
 from?
 
 I know it because I've been a programmer for 39 years.
 

But, to get back to the OP’s original question.  The earliest manuals that I 
remember looking at (from DEC, remember them) all had sections in the front 
that listed the typological conventions used throughout the manual.  Those 
included the use of square brackets to indicate optional arguments.  Eventually 
some of those conventions, including [ ] and the use of a fixed width font to 
indicate screen output, became so wide spread as to be simply part of the 
cultural context.  

A fair number of “Introduction to . . .” programming books still have such a 
section.

Bill

 that's awesome!!
 
 Well I started in 1971 or thereabouts.
 
 1959 for me ;-)
 
 
 Approximately 1968 for me. I wrote programs in 1967, but didn't
 get to run them till 1968.
 -- 
 DaveA
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: [OFF-TOPIC] It is true that is impossible write in binary code, the lowest level of programming that you can write is in hex code?

2014-11-06 Thread William Ray Wing

 On Nov 5, 2014, at 6:14 PM, Clayton Kirkwood c...@godblessthe.us wrote:
 
 Yeah, the 11 was mesmerizing. You didn't need no stinkin' program to see how
 busy the system was, you just checked the lights. You could really tell when
 somebody was compiling or link/loading. As I've done many times since those
 days, I am amazed how many users could be using the system simultaneously
 (yes, general editing, but still...) and it wasn't a quick machine by any
 stretch. We had a whopping 384K memory and big multi-platter disks with a
 whopping 65MB. Still think in terms of PIP sometimes…
 

And TECO. . .

 Clayton

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


Re: [OT] spelling colour / color was Re: Toggle

2014-10-11 Thread William Ray Wing
On Oct 11, 2014, at 3:20 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:

 On Sat, 11 Oct 2014 16:26:43 +0100, duncan smith buzzard@invalid.invalid
 declaimed the following:
 
 
 The media have their own quirks when it comes to English. The BBC
 regularly use top of / bottom of in the sense of start of / end
 of, but I don't know any British people who would (currently) use that
 in conversation. (This only started a few years ago, and the first time
 I heard it I had to work out what it meant from context.)
 
 
   That usage I think is ancient... I'm sure I've heard it back when there
 was a reasonable BBC World Service (along with VOA, Radio Netherlands, and
 etc. running on Short Wave...
 
   Top of the Hour…

Of course, musicians have used it for years, as in “Take it from the top.”

And (with reference to the earlier discussion), just because something is 
specified in the Oxford English Dictionary, doesn’t mean it is universally 
approved of.  Take the “Oxford Comma” for example.

-Bill

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


Re: python script monitor

2014-09-15 Thread William Ray Wing
On Sep 15, 2014, at 8:07 PM, Nicholas Cannon nicholascann...@gmail.com wrote:

 I have made an app that is not fully stable and I would like to monitor the 
 performance of the app and try and improve the speed of it. I tried to use 
 the activity monitor on the mac but what I want I'm to see how much ram, cup 
 and other stats on what resources that app is using. Is there any apps to 
 specifically monitor a certain app. I am on Mac is so any suggestions that 
 could work with that would be great.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Have you investigated the (long) list of options to the “top” command?  I’ve 
noticed that most Mac users seem to assume that top won’t show anything that 
Apple’s Activity Monitor doesn’t show.  In fact top is WAY more powerful.  It 
should do pretty much what you want.

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


Re: running a python program

2014-08-27 Thread William Ray Wing
On Aug 27, 2014, at 9:42 AM, ngangsia akumbo ngang...@gmail.com wrote:

 i have written a small scripts in python that inputs two values and prints 
 out the sum.
 
 Ok i want to be able to install this program on a windows 8 machine and run 
 it as a normal program.
 
 i want to be able to run it to any windows machine without necessarily 
 installing python on that machine.
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

You might try Googling Python to exe.

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


Re: Small World Network model random data generation

2014-08-26 Thread William Ray Wing
On Aug 26, 2014, at 9:23 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:

 On Tue, 26 Aug 2014 12:16:33 +0200, lavanya addepalli phani@gmail.com
 declaimed the following:
 
 How can i generate a random data that is identical to my realworld data
 
 
   By definition, random data will be unlikely to ever be identical to
 your realworld data.
 
 
 i am supposed to refer the attached paper
 
 Real Data
 
 node pairs and the time they spend together connected
 
 node node time in seconds
 4391 2814 16.0

[byte]

 1885 1158 351.0
 1349 1174 6375.0
 
 
   Since I see no cases of duplicate node /pairs/ it is difficult to
 figure out just what that data really represents...
 
   With enough data, with duplicate pairs having different times, I'd
 likely group by pairs, generate mean and standard deviation for the times
 of the matching pairs, then generate some count of the pairs to develop
 weights... Finally, using the weights I'd attempt to generate random node
 pairs and then use the mean/SD of the result pair to generate a time from
 the gaussian distribution.
 
   With only the data you have, I'd end up with a sparse 2D matrix
 M[first_node, second_node] = time
 
   And then selecting random samples from that...
 -- 
   Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

I think the OP wanted to create some sort of test file that was formatted
like his real-world data, but was filled with artificial data.  That, of
course simply becomes an exercise in creating lists of random 4-digit integers
and floats, then arranging them as lines and writing out the data.

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


Re: Python makes Dilbert's list

2014-08-24 Thread William Ray Wing
On Aug 24, 2014, at 7:18 PM, Terry Reedy tjre...@udel.edu wrote:

 For Sunday, Aug 24, 2014.
 http://www.dilbert.com/dyn/str_strip/0//000/20/2/5000/500/225504/225504.strip.sunday.gif
 — 
And at the risk of straying a bit OT, here is what Dilbert should have pointed 
his boss at wrt string theory.
(And by the way - the physics is bang on.)

http://www.npr.org/blogs/krulwich/2013/09/18/223716891/mama-mia-mama-mia-a-canadian-bohemian-rhapsodizes-about-string-theory

-Bill

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


Re: newbee

2014-08-13 Thread William Ray Wing
On Aug 13, 2014, at 9:57 AM, alister alister.nospam.w...@ntlworld.com wrote:

 On Wed, 13 Aug 2014 15:13:34 +0200, Mok-Kong Shen wrote:
 
 Am 13.08.2014 13:55, schrieb alister:
 [snip]
 
 A related question: How could one write a Python program and have it run
 on a mobile phone in general (independent of a PC)?
 
 M. K. Shen
 
 you would need a python interpreter for that device, IIRC there is one 
 available for android, I do not know about IOS
 

There are several for iOS, but because of Apple’s sandboxing they don’t have as 
much reach as you might want.

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


Re: Does python support ATL Modelling Language?

2014-07-09 Thread William Ray Wing
On Jul 9, 2014, at 4:38 AM, varun bhatnagar varun292...@gmail.com wrote:

 Hi,
 
 I am trying to shift my application from JAVA to Python and in JAVA I am 
 using ATL Transformations (modelling techniques). Is it possible to do that 
 with Python, does python support ATL Transformations. If not is there any 
 API/library/module which supports this?
 
 Any kind of help will be appreciated! :)
 
 Thanks,
 BR,
 Varun
 -- 
 https://mail.python.org/mailman/listinfo/python-list

I know next to nothing about model transformation languages.  However, a few 
seconds in Wikipedia and Google turned up:

http://www.lfd.uci.edu/~gohlke/code/transformations.py.html

If you Google for “python model transformation” you will get a fair list of 
other possibilities.

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


Re: cx_freeze and temporary files - security related question

2014-07-06 Thread William Ray Wing

On Jul 6, 2014, at 9:21 AM, Richard Damon rich...@damon-family.org wrote:

 On 5/21/14, 12:42 PM, Nagy László Zsolt wrote:
 I need to create an application for Windows 7 that runs from a flash
 drive. This program would be used to create remote backups of the
 pendrive. The pendrive contains sensitive data, so when I plug in the
 pendrive and run the program to make a backup, it should not leave any
 trace of operation on the windows system. The information is so
 sensitive that I was forbidden to use cloud storage. I was also
 forbidden to make backups to a local drive, or leave any trace on the
 host windows system.
 
 The question is this: if I create this program with Python 3.4 and
 cx_Freeze, then what should I expect. When the user starts the
 cx_freeze-d program from the flash drive, will it create temporary files
 on the system drive? Will it leave log files or store any permanent or
 temporary data on the system drive (maybe in the user's tmp folder) that
 can later be used to tell what drive was mounted, with what parameters
 the program was started etc.
 
 Thanks
 
 
 I am not sure about what temp files python might leave around, but if you are 
 being ultimately paranoid about this, one risk that will be present is the 
 possibility of leaving traces of data in the swap file. If the program 
 doesn't specifically prohibit it, anything that is brought into memory (and 
 the act of reading the pendrive will do this) might end up in the swap file.
 
 I can't imagine python having a run time option to force it to disable the 
 swap file.
 
 If the data is as sensitive as they seem to want to treat it, perhaps you 
 should follow the procedures of classified computing, which says that any 
 storage medium exposed to classified computing becomes classified. This 
 would say that you would use a dedicated machine to do these backups, and 
 after doing them, you remove the hard disk from the machine and lock it up, 
 only to be taken out for later backups. This level of paranoia says you don't 
 need to be as concerned about figuring out what traces might be left, you 
 assume they are and lock them up.
 — 

Furthermore, I don’t know about Windows, but on many UNIX-like OSs, the file 
system preserves the time the file was last accessed.  If the goal is truly to 
leave no traces of the fact that the a group of files was backed up, this 
pretty well would be a red flag that they had been.

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


Re: What use with Python

2014-07-01 Thread William Ray Wing
On Jul 1, 2014, at 6:56 PM, rxjw...@gmail.com wrote:

 Hi,
 
 I am new to Python. Weeks ago, I was asked about Python questions on an 
 interview.
 Now I want to learn Python, but I do not know what I can do with it on a PC. 
 Especially I would like to do something interesting instead of some text 
 search etc.
 Python may can do more than I realize now. Could you tell me something on a 
 PC?
 
 Thanks,
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Python is a completely general purpose programming language.  It has extensive 
libraries that adapt it to tackle almost any programming problem (with the 
possible exception of device drivers).  Those libraries include several 
graphics packages and GUI frameworks, libraries for doing network programming, 
for performing heavy-duty numerical analysis (number crunching) and scientific 
data analysis, as well as web applications, semantic analysis, statistical 
analysis, and which will interface it to any of several databases.

Examples of well-known Python programs running “in the wild” include YouTube 
and Bit Torrent.

Well written Python programs (that is, those that use Python’s abstracted OS 
services) run equally well on a PC, a Mac, UNIX, and Linux.

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


Re: Python ORM library for distributed mostly-read-only objects?

2014-06-23 Thread William Ray Wing
On Jun 23, 2014, at 12:26 AM, smur...@gmail.com wrote:

 On Sunday, June 22, 2014 3:49:53 PM UTC+2, Roy Smith wrote:
 
 Can you give us some more quantitative idea of your requirements?  How 
 many objects?  How much total data is being stored?  How many queries 
 per second, and what is the acceptable latency for a query?
 
 Not yet, A whole lot, More than fits in memory, That depends.
 
 To explain. The data is a network of diverse related objects. I can keep the 
 most-used objects in memory but not all of them. Indeed, I _need_ to keep 
 them, otherwise this will be too slow, even when using Mongo instead of 
 SQLAlchemy. Which objects are most-used changes over time.
 

Are you sure it won’t fit in memory?  Default server memory configs these days 
tend to start at 128 Gig, and scale to 256 or 384 Gig.

-Bill


 I could work with MongoEngine by judicious hacking (augment DocumentField 
 dereferencing with a local cache), but that leaves the update problem.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: IDE for python

2014-05-28 Thread William Ray Wing
On May 28, 2014, at 6:43 AM, Sameer Rathoud sameer.rath...@gmail.com wrote:

 Hello everyone,
 
 I am new to python.
 
 I am currently using python 3.3
 
 With python I got IDLE, but I am not very comfortable with this.
 
 Please suggest, if we have any free ide for python development.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

There are several comparison tables and reviews of Python IDEs on the web.
You should check the following and see what suits you best:

http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments#Python

http://www.pythoncentral.io/comparison-of-python-ides-development/

https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

http://pedrokroger.net/choosing-best-python-ide/

http://spyced.blogspot.com/2005/09/review-of-6-python-ides.html

Good Luck,
-Bill

PS: As it happens, I use (and like) Wing IDE, but have NO relation to the 
development company,
other than as a satisfied user.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can Python do this? First steps, links to resources or complete software referals appreciated.

2014-05-22 Thread William Ray Wing
On May 22, 2014, at 6:03 AM, ed.cot...@gmail.com wrote:

 Hi, I'm an academic and I want to find/adapt/create a script that will grab 
 abstracts (150-250 words of text) from Google Scholar search results and sort 
 them by relevance (e.g. keywords, keyword combinations, anything other way 
 you can think of). 
 
 Any of you guys know of a script that does this already? Preferably open 
 source? If not, any resources you could bring to my attention? I' a complete 
 Newb!
 
 Thanks for your help. 
 
 Ed
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Well, you might take a look at scholar.py, located here:  
http://www.icir.org/christian/scholar.html

Also, there is this at stackoverflow:  
http://stackoverflow.com/questions/13200709/extract-google-scholar-results-using-python-or-r

One of these may provide what you want, or serve as a jumping off point.

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


Re: Significant digits in a float?

2014-05-01 Thread William Ray Wing
On May 1, 2014, at 12:16 AM, Mark H Harris harrismh...@gmail.com wrote:

 On 4/30/14 10:56 PM, Paul Rubin wrote:
 
 There is a nice Javascript simulation of the N4-ES here:
 
 http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html
 
 
 Thank you!
 
 The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES on the 
 site is yellow (mine is white) and the site rule indicates Picket  Eckel 
 Inc. (that's where the E comes from)  Also the the ES states Chicage Ill USA 
 where the T states Made in USA.
 

I’ve resisted - but finally have to jump into this discussion...

Picket used to talk a lot about their yellow background being optimized for the 
color the human eye was most sensitive to and therefore produced the sharpest 
focus and allowed the most precise reading of the scales.  Nice theory, but at 
least on MY Picket rule the scales were printed not engraved and the result 
negated any possible advantage the color might have given.

I’m surprised no one has jumped in to defend/tout the Dietzgen slide rules 
(which I always thought were the ultimate).  Mine (their Vector Log Log) is one 
of their Microglide series that had teflon rails inserted in the body and is 
still totally stick-free after nearly 50 years.

Taking it one step further, I _ALSO_ have a Curta Type II calculator 
http://en.wikipedia.org/wiki/Curta_calculator - which still operates as 
smoothly as it did the day I bought it.

-Bill

 The only technical difference is the T scale (which is folded-expanded on 
 both). On the ES the T scale is listed only once in the margin.  On the N4-T 
 the T scale is listed 'twice'!--  once for each part of the fold.  Well, that 
 gives (2) scales instead of one --for T...  increasing the number of scales 
 on the rule from 34 to 35... if I'm counting right.  Which makes the N4-T 
 more valuable... supposedly.  I don't plan are parting with it... till I 
 croak, then my son (who is studying engineering this fall) will inherit it... 
  heh   he won't have a clue what to do with it !
 
 The simulated rule on the site above is fabulous... especially if viewed from 
 a large wide LED.  ... simply fabulouso/:)
 
 
 
 marcus
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Latching variables in function

2014-04-09 Thread William Ray Wing
On Apr 9, 2014, at 12:35 AM, Terry Reedy tjre...@udel.edu wrote:

 On 4/8/2014 4:09 PM, Grawburg wrote:
 
 I've probably used the wrong term - I'm thinking of what I do when writing 
 PLC code - so I can't find how to do this in my reference books.
 This is part of a project I'm working on with a Raspberry Pi and an MCP23017 
 port expander.
 I have a N/O pushbutton that I want to latch a value to a variable when 
 it's been pressed.  I have this function that gets called periodically in
 a 'while True' statement:
 
 def button():
pushbutton = 0
   button_value = 0
pushbutton=bus.read_byte_data(address,GPIOB)
if pushbutton  0:
 button_value = 1
return button_value
 
 I need button_value to become '1' when the button is pressed and to remain 
 '1' until the entire program (only about 25 lines) ends with a sys.exit()
 
 What do I use to 'latch' button_value?
 
 It depends on whether you can set up your system so that pushing the button 
 generates an interrupt. But I know little about R.Pi and less about the 'port 
 expander'. If there were an interrupt, you would just have to write an 
 interrupt handler. When possible, this is much better than polling.
 
 -- 
 Terry Jan Reedy
 

I think what the OP was asking for was a way in standard Python to “lock the 
value of an instance variable, which of course, you really can’t do. However, 
what he (I assume it’s a he) could do is arrange his calling program so that 
after the button method returns a “1”, the method isn’t called again.  That is, 
test for truth of button = 1 in the calling program, and if true, skip the 
call.  The next time the program runs, the button value will be re-initialized 
to zero and everything is back to square one.

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


Re: Switching between cmd.CMD instances

2014-04-02 Thread William Ray Wing
On Apr 2, 2014, at 1:03 AM, Josh English joshua.r.engl...@gmail.com wrote:

 I have a program with several cmd.Cmd instances. I am trying to figure out 
 what the best way to organize them should be.
 
 I've got my BossCmd, SubmissionCmd, and StoryCmd objects.
 
 The BossCmd object can start either of the other two, and this module allows 
 the user switch back and forth between them. Exiting either of the 
 sub-command objects returns back to the BossCmd.
 
 I have defined both a do_done and do_exit method on the sub-commands.
 
 Is it possible to flag BossCmd so when either of the other two process 
 do_exit, the BossCmd will also exit?
 
 Josh
 

I am anything BUT a super experienced Python programmer, but if it were my 
problem - and if BossCmd has anything like an event loop in it, then certainly 
one way to handle this would be to have a Status.py module that contained 
status flags for each of the modules.  All three modules would import status” 
and do_done and do_exit would set status flags in status.py on their way out.

I’m sure there are better answers.  I’ll be interested to see what else is 
suggested.

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


Re: Python programming

2014-03-07 Thread William Ray Wing
On Mar 7, 2014, at 1:03 PM, John Ladasky john_lada...@sbcglobal.net wrote:

 
 As for FORTRAN?  This week, I actually downloaded an application which 
 required a FORTRAN compiler.  This is the only FORTRAN application I've ever 
 needed.  It's not old code, the first revision came out about 10 years ago.  
 More than once, I have queried Google with the phrase Why isn't FORTRAN dead 
 yet?  For some reason, it lives on.  I can't say that I understand why.  
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Well, I’d claim that for what it was designed for (FORTRAN stands for FORmula 
TRANslator after all), it is still pretty da*mn good.  It generates extremely 
fast, robust code that requires much less debugging effort than the equivalent 
C or C++ requires.  Most of the physicists I know still write FORTRAN, although 
they no longer do so exclusively.

Of course, as has been pointed out, the HUGE code base of scientific and 
numerical analysis code that already exists in FORTRAN makes rewriting sort of 
a waste of grant (or company) money.

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


Re: Python programming

2014-03-06 Thread William Ray Wing

On Mar 6, 2014, at 8:24 PM, Roy Smith r...@panix.com wrote:

 In article mailman.7884.1394151937.18130.python-l...@python.org,
 Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 
 On 06 Mar 2014 02:51:54 GMT, alb...@spenarnc.xs4all.nl (Albert van der
 Horst) declaimed the following:
 
 In article roy-a94c1b.22041912022...@news.panix.com,
 Roy Smith  r...@panix.com wrote:
 In article ldhcau$d9v$1...@reader1.panix.com,
 Grant Edwards invalid@invalid.invalid wrote:
 
 On 2014-02-13, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 
   An S-100 wire-wrap board.
 
 Yup, been there done that!
 
 Never did S-100, but I did do a custom Unibus card (wirewrap).
 
 You know you're working with a Real Computer (tm) when the +5V power
 supply can deliver as much current as an arc welder.
 
 I've a 64 node Parsytec transputer system in the hall way with
 dual 5V 100A power supplies. Does that count?
 
  I spotted a device on the table of the company calibration office...
 
  As I recall, it was a 100A capable resistor... 0.10 OHM.
 
  No idea what it was meant for; big binding posts at one end, and a slab
 of sheet steel in a W shape (smooth curves, not sharp bends).
 
 External shunt for an ammeter?
  

More likely a dummy load for power supply testing.  (Normally, ammeter shunts 
are sized to dissipate as little power as possible.)

-Bill

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


Re: Mac vs. Linux for Python Development

2014-02-24 Thread William Ray Wing
On Feb 23, 2014, at 3:43 AM, twiz twiza...@gmail.com wrote:

 Hello,
 
 I'm sure this is a common question but I can't seem to find a previous thread 
 that addresses it.   If one one exists, please point me to it.
 
 I've been developing with python recreationally for a while on Ubuntu but 
 will soon be transitioning to full-time python development.  I have the 
 option of using a Mac or Ubuntu environment and I'd like to hear any thoughts 
 on the pros and cons of each. Specifically, how's the support for numpy and 
 scipy?  How are the IDEs?
 
 Since I generally like working with a Mac, I'd like to hear if there are any 
 significant downsides to python dev on OsX.  
 
 Thanks
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

In addition to the other excellent answers you've received, I'd point you to

http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

where there is a fairly extensive comparison chart of IDEs, features, and 
supported OSes.

And, by the way, I'm a very happy camper using BBEdit and WingIDE (the name 
collision is purely coincidental).

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


Re: Coding a simple state machine in python

2014-02-24 Thread William Ray Wing

On Feb 24, 2014, at 8:30 PM, Ronaldo abhishek1...@gmail.com wrote:

 How do I write a state machine in python? I have identified the states and 
 the conditions. Is it possible to do simple a if-then-else sort of an 
 algorithm? Below is some pseudo code:
 
 if state == ABC:
   do_something()
   change state to DEF
 
 if state == DEF
   perform_the_next_function()
 ...
 
 I have a class to which certain values are passed from a GUI and the 
 functions above have to make use of those variables. How do I go about doing 
 this? I have the following algorithm:
 
 class TestClass():
def __init__(self, var1, var2): #var1 and var2 are received from a GUI
   self.var1 = var1
 ...
if state == ABC
   doSomething(var1, var2)
 ..
 
 Could someone point me in the right direction? Thank you!
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list

And, to extend Tim's suggestion of a dictionary just a bit, note that since 
Python functions are happy to pass function names as arguments, you can use a 
dictionary to make a really nice compact dispatch table.  That is, function A 
does its thing, gets to a new state, and returns as one of its return arguments 
the key into the dictionary that points to the next function_name to be called 
based on that new state.

Stackoverflow has a couple of compact examples here:  

http://stackoverflow.com/questions/715457/how-do-you-implement-a-dispatch-table-in-your-language-of-choice

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


Re: Just For Inquiry

2014-02-20 Thread William Ray Wing
On Feb 20, 2014, at 5:48 PM, John Gordon gor...@panix.com wrote:

 In mailman.7196.1392914525.18130.python-l...@python.org shivang patel 
 patelshivan...@gmail.com writes:
 
 So, I kindly request to you please, give me a very brief info regarding
 *Role of Project Manager*.
 
 In my organization, a project manager does these things (and a lot more):
 Ensure that a requirements document exists, and is approved by both the
  customer and the developer.
 Work with developers to create a list of all work steps necessary to
  complete the project.
 Create a project schedule from developer estimates for each item on the
  work list, and update the schedule as needed if additional steps are added
  or a step takes longer than anticipated.
 Communicate with customers to keep them informed of the project's progress.
 Schedule meetings with the customer as needed.
 Ensure that a test plan exists and is carried out.
 Coordinate project delivery and installation.
 Coordinate bug reports and bugfixes.
 
 -- 
 John Gordon Imagine what it must be like for a real medical doctor to
 gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.

An excellent list, I would add that frequently the project manager has 
significant budget responsibilities as well.

In an informal sense, the project manager is the point person for keeping a 
project on track, on budget, and completed in a timely fashion.

Software engineers, working FOR a project manager, frequently feel that the 
project manager is providing no added value.  This is NOT true.

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


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread William Ray Wing
On Feb 19, 2014, at 3:14 AM, Sujith S sujith...@gmail.com wrote:

 Hi,
 
 I am new to programming and python. I am looking for a python script to do 
 ssh/telnet to a network equipment ? I know tcl/perl does this using 
 expect/send. 
 
 Do we have expect available in python as well or need to use some other 
 method ?
 
 Regards
 Sujith
 -- 
 https://mail.python.org/mailman/listinfo/python-list

In addition to the other answers you've received (and noting that you are 
familiar with expect), you might want to investigate the pexpect module. 
Google will give you quite a long list of references to it, but you could start 
here:  http://pexpect.readthedocs.org/en/latest/

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


Re: Python programming

2014-02-12 Thread William Ray Wing
On Feb 12, 2014, at 10:04 PM, Roy Smith r...@panix.com wrote:

 In article ldhcau$d9v$1...@reader1.panix.com,
 Grant Edwards invalid@invalid.invalid wrote:
 
 On 2014-02-13, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 
 An S-100 wire-wrap board.
 
 Yup, been there done that!
 
 Never did S-100, but I did do a custom Unibus card (wirewrap).
 
 You know you're working with a Real Computer (tm) when the +5V power 
 supply can deliver as much current as an arc welder.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

OK, and how many of you remember the original version of the tongue-in-cheek 
essay Real Programmers Don't Use Pascal from the back page of Datamation?

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


Re: Newcomer Help

2014-02-10 Thread William Ray Wing
On Feb 10, 2014, at 11:10 AM, Walter Hughey wkhug...@gmail.com wrote:

 I am new to Python programming, actually new to any programming language. I 
 sent the email below to the pythonmac-...@python.org a few days ago. So far 
 I have not seen a reply, actually, I have not seen anything from pythonmac in 
 any emails although I am supposed to be a member.
 
 I don't know if I am sending these to the correct place or if I am not 
 receiving emails from the pythonmac list. I would appreciate any assistance 
 either in how do I get to the pythonmac list or answers to the issue below. I 
 went to the pythonmac list because I am trying to run Python 3.3 on a Mac 
 computer.
 
 Thank you,
 
 Walter

Walter, I'm one of the (relatively few) people on this list who develops using 
Macs and therefore also subscribes to pythonmac-sig.  I don't know what may 
have happened to your e-mail, but I can assure you that if you didn't get 
answers from the pythonmac list it wasn't because people were ignoring you.  
I've looked back through the last six months of pythonmac and saw nothing with 
your name in it.

I assume you signed up here:  
https://mail.python.org/mailman/listinfo/pythonmac-sig if not, that would 
explain things.

I see others are providing the help you need, so I won't attempt any other 
comments.

-Bill

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


Re: [RELEASED] Python 3.3.4 release candidate 1

2014-01-27 Thread William Ray Wing
On Jan 27, 2014, at 8:55 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:

 On 27/01/2014 07:36, Georg Brandl wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On behalf of the Python development team, I'm reasonably happy to announce 
 the
 Python 3.3.4 release candidate 1.
 
 
 Reasonably happy?  Is there a smiley missing there, or what? :)
 
 -- 
 My fellow Pythonistas, ask not what our language can do for you, ask what you 
 can do for our language.
 
 Mark Lawrence

I'm guessing it is an editorial comment about Mac users/developers.
But maybe I'm being defensive...   ;-)
-Bill
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning python networking

2014-01-15 Thread William Ray Wing
On Jan 15, 2014, at 11:31 AM, Chris Angelico ros...@gmail.com wrote:

 On Thu, Jan 16, 2014 at 3:25 AM, William Ray Wing w...@mac.com wrote:
 On Jan 15, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote:
 One of the fundamentals of the internet is that connections *will*
 break. A friend of mine introduced me to Magic: The Gathering via a
 program that couldn't handle drop-outs, and it got extremely
 frustrating - we couldn't get a game going. Build your server such
 that your clients can disconnect and reconnect, and you protect
 yourself against half the problem; allow them to connect and kick the
 other connection off, and you solve the other half.
 
 But note VERY carefully that this can open HUGE security holes if not done 
 with extreme care.
 
 Leaving a dangling connection (not session, TCP closes sessions) open is an 
 invitation so bad things happening.
 
 Not sure what you mean here. I'm assuming an authentication system
 that stipulates one single active connection per authenticated user
 (if you reauthenticate with the same credentials, it'll disconnect the
 other one on the presumption that the connection's been lost). In
 terms of resource wastage, there's no difference between disconnecting
 now and letting it time out, and waiting the ten minutes (or whatever)
 and then terminating cleanly. Or do you mean another user gaining
 access? It's still governed by the same authentication.
 

I was assuming another user picking up the connection using sniffed credentials 
(and yes, despite all the work on ssh, not all man-in-the-middle attacks have 
been killed).

-Bill

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

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


Re: Learning python networking

2014-01-15 Thread William Ray Wing
On Jan 15, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote:

[megabyte]

 One of the fundamentals of the internet is that connections *will*
 break. A friend of mine introduced me to Magic: The Gathering via a
 program that couldn't handle drop-outs, and it got extremely
 frustrating - we couldn't get a game going. Build your server such
 that your clients can disconnect and reconnect, and you protect
 yourself against half the problem; allow them to connect and kick the
 other connection off, and you solve the other half. (Sometimes, the
 server won't know that the client has gone, so it helps to be able to
 kick like that.) It might not be an issue when you're playing around
 with localhost, and you could even get away with it on a LAN, but on
 the internet, it's so much more friendly to your users to let them
 connect multiple times like that.

But note VERY carefully that this can open HUGE security holes if not done with 
extreme care.

Leaving a dangling connection (not session, TCP closes sessions) open is an 
invitation so bad things happening.

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


Re: How to get Mac address of ethernet port?

2014-01-13 Thread William Ray Wing
On Jan 11, 2014, at 11:34 AM, Michael Torrie torr...@gmail.com wrote:

 On 01/11/2014 07:35 AM, Andriy Kornatskyy wrote:
 Sam,
 
 How about this?
 
 from uuid import getnode as get_mac
 '%012x' % get_mac()
 
 This seems to work if you have only one ethernet adapter.  Most
 computers have two (wired and wireless) adapters.
 
 Getting a mac address is platform-specific, and the OP has not specified
 what OS he is using.
 
 On Windows I imagine you'd have to access the WMI subsystem in Windows.
 
 On Linux you could access the /sys/devices/virtual/net/interface name
 file in the sysfs filesystem.  I'm sure there are other ways.
 
 No idea on OS X.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

There are probably several ways in OS-X, just as there are in any other UNIX 
system.  The one I've used is to spawn a subprocess and run the ifconfig 
command with no arguments (which doesn't require any special privileges).  This 
will return a string of all the network interfaces (including the loopback and 
firewire interfaces in addition to Ethernet and WiFi) and their config specs.  
The OP would then parse this string looking for the location of the phrase 
status: active and then back up to the mac address that precedes it.  More 
work than using uuid, but this guarantees a current and correct answer.

 import string
 import subprocess
 mac_result = subprocess.Popen(['ifconfig'], stderr = subprocess.PIPE, 
 stdout = subprocess.PIPE).communicate()[0]
 mac_loc = string.find(mac_result, status: active)

...and so on.

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


Re: Looking for tips for moving dev environment from Windows to Mac

2014-01-08 Thread William Ray Wing
On Jan 8, 2014, at 9:11 AM, pyt...@bdurham.com wrote:

 Long time Windows developer making the move to Apple platform. My new 
 development environment is a 15 MacBook Pro with 16 Gb RAM and a 512 Gb SSD. 
 I'm totally new to the world of Apple hardware and software and am looking 
 for advice on what apps, utilities and hardware I should consider for my new 
 environment..

Welcome to the world of Macs, OS-X, and Darwin.

  
 Some early questions:
  
 1. Which distribution of Python to install (Python.org, ActivateState, 
 other?) and do I need to do anything special to avoid overwriting the system 
 copy of Python?
  

The answer to this is going to depend on exactly what you are intending to do.  
ActiveState (for example) has what may well be the best totally integrated 
package of libraries (GUI, numpy, mathplotlib, and such), but has a pretty 
expensive license if you are going to do commercial development.  Tell us more 
if you want a better recommendation.


 2. Text editor: Textmate, BBEdit, Emacs/VI, or other?
  

At the risk of setting off a religious war; I use BBEdit (have used it for 
years, and have been very pleased with its speed, power, regular updates, and 
integration with the OS).  There is strong support for other editors on this 
list, I'm sure you will hear from supporters of vi, Emacs, and Vim.

 3. Multiple external monitors: Any recommendations on monitor specs/models 
 for 2 external monitors for a MacBook?

I use Apple monitors, but that's strictly personal.

  
 4. Best visual diff utility for Mac?

BBEdit has a nice built-in diff with side-by-side scrolling windows.  When 
combined with its code-folding, multi-file search, and built-in python support, 
it makes a nice package.

  
 Any other gotta have Mac apps, utilities, or hardware accessories you would 
 recommend?

Two external disks.  One dedicated to TimeMachine for continuous backups of 
code as you write it, and one dedicated to either CarbonCopy Cloner or 
SuperDuper.  Whichever you choose, set it up to do once-a-week clones at say 
2:00 AM Sunday.  Modern Mac's are just as hard to crash as any other modern 
UNIX-derived system, and Mac laptops continue to top Consumer Reports list of 
trouble-free systems, but ANY hardware can develop problems and it pays to be 
paranoid. 

Again, welcome.

-Bill

  
 Thank you!
 Malcolm
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Looking for tips for moving dev environment from Windows to Mac

2014-01-08 Thread William Ray Wing
On Jan 8, 2014, at 12:26 PM, Bob Hartwig bobje...@gmail.com wrote:

 4. Best visual diff utility for Mac?
 
 opendiff.  I think it's part of xcode.
 
 Regarding Python IDEs, I really like PyCharm.  It's written in Java, and 
 sometimes you can tell that by its performance, but it's very featureful and 
 has a great debugger, and your 16 GB box should support it nicely.
 
 Bob
 

Malcom - I didn't mention IDE's since you didn't explicitly ask, but I use 
WingIDE (and no, I have NO relationship with the company), and have been very 
pleased by the company's responsiveness and help.  They have a free trial you 
can download and versions with three levels of capabilities, sophistication, 
and price.  These range from student (free) through personal and professional.

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


Re: Question RE urllib

2013-12-16 Thread William Ray Wing
On Dec 16, 2013, at 6:40 AM, Jeff James j...@jeffljames.com wrote:

 So I'm using the following script to check our sites to make sure they are 
 all up and some of them are reporting they are down when, in fact, they are 
 actually up.   These sites do not require a logon in order for the home page 
 to come up.  Could this be due to some port being blocked internally ?  Only 
 one of the sites reporting as down is https but all are internal sites.  Is 
 there some other component I should be including in the script ?  There are 
 about 30 or 40 sites that I have listed in all.  I just use those in the 
 following script as examples.   Thanks
 
 import urllib
 
 sites = [http://www.amazon.com/;, https://internalsite.com/intranet.html;, 
 etc.]
 
 for site in sites:
 try:
 urllib.urlopen(site)
 print site +  
 except Exception, e:
 print site +  is down
 -- 
 https://mail.python.org/mailman/listinfo/python-list

I've never used urllib, although I've done a fair amount of network programming 
at lower levels.

Are you sure the report of down isn't simply a time out due to the server 
being busier than you expect when you hit it?

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-09 Thread William Ray Wing
On Dec 9, 2013, at 11:57 AM, rusi rustompm...@gmail.com wrote:

 On Monday, December 9, 2013 5:53:41 PM UTC+5:30, Oscar Benjamin wrote:
 5) Learning to program should be painful and we should expect the
 students to complain about it (someone actually said that!) but the
 pain makes them better programmers in the end.
 
 Yeah this will get some people's back up -- Atrocious! Preposterous! etc
 
 Change the word 'pain' to 'taxing' 'hard' 'challenge' etc and there is much
 truth in it.  Here is Joel Spolsky on why Java is a poor language for
 this reason: 
 http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html
 -- 
 https://mail.python.org/mailman/listinfo/python-list

I'm not sure I agree with either of these points of view. Based on my own 
personal experience, there is an Ah HA! moment[*] when a student understands 
what it means to decompose a problem into a series of algorithmic steps - after 
that, the details of the particular programming language are just that, details.

Some students get that quickly and intuitively and some never get there, but 
that bit of fundamental understanding doesn't require either pain or 
(necessarily) hard work - it just requires adopting a way of approaching and 
thinking about problems, a mind-set.

-Bill

* For me it came during a no-credit, no-cost, lunch-time course one of my 
college math teachers offered for anyone who was interested.  The year was 
1963, we used McCracken's FORTRAN book as our text, and tested our programs 
over open weekends at Argonne National Lab, where they had an IBM 1620 they 
opened to classes like ours a couple of times a month.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-23 Thread William Ray Wing
On Nov 23, 2013, at 1:42 AM, Ian Kelly ian.g.ke...@gmail.com wrote:

 On Fri, Nov 22, 2013 at 7:18 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 I'm not an expert on Indian English, but I understand that in that
 dialect it is grammatically correct to say the codes, just as in UK and
 US English it is grammatically correct to say the programs.
 
 I wouldn't necessarily even consider it an Indian thing, as I've known
 Americans to use the same phrase.
 

Yes - when I arrived at a Department of Energy national laboratory in the late 
1960s, code, to code, and coding were pretty much the accepted verb forms.  To 
the best of my knowledge, the word program didn't start to creep in until 
later.  I'm guessing, but I'd assume it started to arrive with the first 
computer science graduates.

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


Re: Program Translation - Nov. 14, 2013

2013-11-16 Thread William Ray Wing
On Nov 16, 2013, at 4:31 AM, Terence tbwri...@bigpond.net.au wrote:

 I downloaded the packed file mentioned, extracted the files and had a look
 at the Fortran sources given:
 ETGTAB.FOR and ETGTAB.F
 
 The ETGTAB.FOR file had double spacing, which Iremoved automatically, then
 compared the two sources automatically (passing and copying equals and
 offering choice between lexically different lines).
 
 The two files were now very nearly identical, but the .FOR file had some
 CALLs to GEOEXT(IUIT6,DEXTIM) which were commented out in the other; also
 calls to LAHEY timing functions not used in the .F version (and a minor
 change in two format statements which effectively just changed the shift in
 the output report).
 
 I don't see why not either source (given access to the external GEOEXT, etc,
 fuctions) shouldn't be left for compilation (and later running) by any F77
 or later compiler. The code is still valid.
 

Then, use F2PY to put a python wrapper around the code, and it could easily be 
incorporated into the python workflow that the OP was originally asking for.

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


Re: Automation

2013-11-16 Thread William Ray Wing
On Nov 16, 2013, at 1:17 AM, Larry Hudson org...@yahoo.com wrote:

[byte]

 
 However, that's just a side comment.  I wanted to mention my personal peeve...
 
 I notice it's surprisingly common for people who are native English-speakers 
 to use 'to' in place of 'too' (to little, to late.), your in place of 
 you're (Your an idiot!) and 'there' in place of 'their' (a foot in there 
 mouth.)  There are similar mis-usages, of course, but those three seem to be 
 the most common.
 
 Now, I'm a 76-year-old curmudgeon and maybe overly sensitive, but I felt a 
 need to vent a bit.
 
 -=- Larry -=-
 

And my personal peeve -  using it's (contraction) when its (possessive) should 
have been used; occasionally vice-versa.

-Bill

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


Re: Python Beginner

2013-11-16 Thread William Ray Wing
On Nov 16, 2013, at 5:25 PM, ngangsia akumbo ngang...@gmail.com wrote:

 I am called Richard m from western Africa, Cameroon. It was a pleasure for me 
 to join this group.
 
 I have been learning python for about 4 months now and i have already 
 mastered alot as far as the language is concern.
 
 I am learning how to code, firstly because i love coding and i like to do 
 stuffs.
 
 secondly, i wihs to start a small company after learning how to code
 
 I am learning python very broadly, meaning i am not concentrating on a single 
 section. I wish to know the language and be able to apply it to any location 
 in the field of tech.
 
 i Need some advise on how, and what python can help me setup a business?
 
 please just honest replies please
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Hi Richard m from western Africa, Cameroon, and welcome to the list.

Your question is VERY broad, and difficult for anyone who is not knowledgeable 
of the context/business-climate in Cameroon to answer (and I'm afraid that 
probably includes most of the people on this list.)

Chris' advice is spot on, BUT, and if for any reason you think circumstances in 
Cameroon would lead to a different answer - then, there are three general areas 
in which a python developer might be able to earn a bit of coin.

1)  Consulting, that is, if you know more about a subject than any OTHER 
businessman in the area, you may be able to sell answers to problems he/they 
may be having

2)  Web development, python (in combination with web-specific frameworks like 
django) is a really powerful tool for developing web sites

3) Specific, proprietary, application development, if there is some 
Cameroon-specific application that other locals like yourself would find so 
useful they would pay money to have it (or an application some local company 
would pay you for), you might be in a position to sell it.

BUT, please note that all three of these are full of if, may, and might 
qualifiers.  They are EXTREMELY difficult to slip through.

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


Re: understanding someone else's program

2013-11-15 Thread William Ray Wing
On Nov 15, 2013, at 6:05 AM, C. Ng ngc...@gmail.com wrote:

 Hi all,
 
 Please suggest how I can understand someone else's program where
 - documentation is sparse
 - in function A, there will be calls to function B, C, D and in those 
 functions will be calls to functions R,S,T and so on so forth... making 
 it difficult to trace what happens to a certain variable
 
 Am using ERIC4 IDE.
 
 Thanks.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

The other suggestions you have received are good places to start.  I'd add only 
one other - that you consider running the code inside an IDE and 
single-stepping through as you watch what happens to the variables.  As you get 
a better and better feel for what the code is doing, you can move up from 
single stepping to setting break points before and after places you are still 
scratching you head over.

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


Re: python 3.3 repr

2013-11-15 Thread William Ray Wing
On Nov 15, 2013, at 10:18 AM, Robin Becker ro...@reportlab.com wrote:

 On 15/11/2013 15:07, Joel Goldstick wrote:
 
 
 
 
 
 Cool, someone here is older than me!  I came in with the 8080, and I
 remember split octal, but sixes are something I missed out on.
 
 The pdp 10/15 had 18 bit words and could be organized as 3*6 or 2*9, pdp 8s 
 had 12 bits I think, then came the IBM 7094 which had 36 bits and finally the 
 CDC6000  7600 machines with 60 bits, some one must have liked 6's
 -mumbling-ly yrs-
 Robin Becker
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Yes, the PDP-8s, LINC-8s, and PDP-12s were all 12-bit computers.  However the 
LINC-8 operated with word-pairs (instruction in one location followed by 
address to be operated on in the next) so it was effectively a 24-bit computer 
and the PDP-12 was able to execute BOTH PDP-8 and LINC-8 instructions (it added 
one extra instruction to each set that flipped the mode).

First assembly language program I ever wrote was on a PDP-12.  (If there is an 
emoticon for a face with a gray beard, I don't know it.)

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


Re: To whoever hacked into my Database

2013-11-13 Thread William Ray Wing
On Nov 13, 2013, at 1:27 PM, superchromix mark...@gmail.com wrote:

 
 
 hi all,
 
 I've been thinking about learning Python for scientific programming.. but all 
 of these flame war type posts make the user community look pretty lame.  How 
 did all of these nice packages get written when most of the user interaction 
 is  this??
 
 Can anyone tell me, is there another newsgroup where the discussion is more 
 on python programming?
 
 thanks
 -- 
 https://mail.python.org/mailman/listinfo/python-list

I'd like to add one final thought to the note about joining the python-tutor 
list.
For scientific programming you are almost certainly going to want to learn 
about scipy, numpy and matplotlib.

These specialized libraries have dedicated discussion groups, which can be 
found at: numpy-discuss...@scipy.org, and 
matplotlib-us...@lists.sourceforge.net

I'd recommend looking over the material at

http://www.scipy.org

Welcome to the community.

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


Re: datetime question

2013-11-12 Thread William Ray Wing
On Nov 12, 2013, at 10:57 AM, Ferrous Cranus nikos.gr...@gmail.com wrote:

 Στις 12/11/2013 5:54 μμ, ο/η Tim Chase έγραψε:
 On 2013-11-12 17:24, Ferrous Cranus wrote:
 But what of the server was in California and i live in Greece?
 
 How would datetime.now() work then?
 
 Best practices say to move the value from local time to UTC as soon
 as possible, then store/use the UTC time internally for all
 operations.  Only when it's about to be presented to the user should
 you convert it back to local time if you need to.
 
 -tkc
 
 
 
 
 or perhaps by confiruing the timezone of the server to use Greece's TimeZone 
 by issuing a linux command?
 -- 
 

Thus totally screwing all the other users/sites hosted on that server? Thus 
totally screwing up all the housekeeping and maintenance OS tasks that are run 
by chron jobs?

Shakes head in dismay...

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


Re: using print() with multiprocessing and pythonw

2013-11-12 Thread William Ray Wing
On Nov 12, 2013, at 2:12 PM, Isaac Gerg isaac.g...@gergltd.com wrote:

 I launch my program with pythonw and begin it with the code below so that all 
 my print()'s go to the log file specified. 
 
 if sys.executable.find('pythonw') =0:
# Redirect all console output to file.
sys.stdout = open(pythonw - stdout stderr.log,'w')
sys.stderr = sys.stdout
 
 During the course of my program, I call multiprocessing.Process() and launch 
 a function several times.  That function has print()'s inside (which are from 
 warnings being printed by python).  This printing causes the multiprocess to 
 crash.  How can I fix my code so that the print()'s are supressed. I would 
 hate to do a warnings.filterwarnings('ignore') because when I unit test those 
 functions, the warnings dont appear.
 
 Thanks in advance,
 Isaac
 -- 
 https://mail.python.org/mailman/listinfo/python-list

This may be inelegant, but it solved a similar problem for me.  Replace the 
print statements with logging.info statements and have each invocation of the 
function dump to a unique log file (with a name based on the function's input). 
 At least in my case, multiprocessing seemed to get its feet tangled (crash) 
when different subprocesses tried to print to the same output file at the same 
time.

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


Re: i want to know about python language

2013-11-07 Thread William Ray Wing
On Nov 7, 2013, at 1:51 AM, Kewl p kewlp...@gmail.com wrote:

 On Thursday, November 7, 2013 8:48:26 AM UTC+5:30, Kewl p wrote:
 h
 
 can i get link of a ide in which python can run,,...??
 -- 
 https://mail.python.org/mailman/listinfo/python-list

There are actually almost too many.  Googling for Python IDE will get you a 
long list of hits to articles.

You could start here:  
http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

And spend several hours reading some of the other links you will get from 
Google.

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


Re: how to load test a web app?

2013-11-06 Thread William Ray Wing
On Nov 6, 2013, at 1:25 PM, Skip Montanaro s...@pobox.com wrote:

 Have a look at selenium and sauce labs:
 
 http://www.seleniumhq.org/
 https://saucelabs.com/
 
 Maybe we should pass that information along to Kathleen Sebelius. :-)
 
 Skip

Definitely!  Anyone seen the cover of this week's issue of the New Yorker?  
http://archives.newyorker.com/#folio=0C1

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


Re: multiprocessing: child process race to answer

2013-11-02 Thread William Ray Wing
On Nov 2, 2013, at 1:03 AM, smhall05 smhal...@gmail.com wrote:

 On Friday, November 1, 2013 10:52:40 PM UTC-4, MRAB wrote:
 On 02/11/2013 02:35, smhall05 wrote:
 
 I am using a basic multiprocessing snippet I found:
 
 #-
 from multiprocessing import Pool
 
 def  f(x):
 return x*x
 
 if __name__ == '__main__':
 pool = Pool(processes=4)  # start 4 worker processes
 result = pool.apply_async(f, [10])# evaluate f(10) asynchronously
 print result.get(timeout=1)
 print pool.map(f, range(10))  # prints [0, 1, 4,..., 81]
 #-
 
 I am using this code to have each process go off and solve the same 
 problem, just with different inputs to the problem. I need to be able to 
 kill all processes once 1 of n processes has come up with the solution. 
 There will only be one answer.
 
 I have tried:
 
 sys.exit(0) #this causes the program to hang
 pool.close()
 pool.terminate
 
 
 Did you actually mean pool.terminate, or is that a typo for
 
 pool.terminate()?
 
 These still allow further processing before the program terminates. What 
 else can I try? I am not able to share the exact code at this time. I can 
 provide more detail if I am unclear. Thank you
 
 
 I am not sure to be honest, however it turns out that I can't use 
 pool.terminate() because pool is defined in main and not accessible under my 
 def in which I check for the correct answer.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

So, the simplest solution to that situation is to have whichever subprocess 
that finds the correct answer set a flag which the calling process can check.  
Depending on your OS, that flag can be anything from setting a lock to 
something as simple as creating a file which the calling process periodically 
wakes up and looks for, maybe just a file in which the subprocess has written 
the answer.

Bill

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


  1   2   >