Re: Python for philosophers

2013-05-15 Thread Tim Daneliuk

On 05/15/2013 08:01 PM, Ned Batchelder wrote:

On 5/11/2013 4:03 PM, Citizen Kant wrote:

Don't get me wrong. I can see the big picture and the amazing things that 
programmers write on Python, it's just that my question points to the lowest 
level of it's existence.


Sometimes a cigar is just a cigar.  Python is a tool, it does what you tell it.  To make 
an analogy, or maybe to clarify your philosophical view of the world, consider a hammer.  
What is the "lowest level of its existence"?

--Ned.


All You People are making this way too hard.  To understand how
questions like the OPs ought be resolved, please read:

   http://pvspade.com/Sartre/cookbook.html




--
----
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Python for philosophers

2013-05-15 Thread Tim Daneliuk

On 05/15/2013 10:43 PM, Terry Jan Reedy wrote:

On 5/15/2013 9:17 PM, Tim Daneliuk wrote:


http://pvspade.com/Sartre/cookbook.html


Wikedly funny.




"Today I made a Black Forest cake out of five pounds of cherries and a live 
beaver,"

--
--------
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Python for philosophers

2013-05-15 Thread Tim Daneliuk

On 05/15/2013 11:49 PM, alex23 wrote:

On May 16, 11:17 am, Tim Daneliuk  wrote:

http://pvspade.com/Sartre/cookbook.html


Best recipe for tuna casserole ever! Cheers for this :)



"I have have realized that the traditional omelet form (eggs and cheese) is 
bourgeois."



--
--------
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Python for philosophers

2013-05-16 Thread Tim Daneliuk

On 05/16/2013 09:27 AM, Grant Edwards wrote:

On 2013-05-16, Tim Daneliuk  wrote:

On 05/15/2013 08:01 PM, Ned Batchelder wrote:

On 5/11/2013 4:03 PM, Citizen Kant wrote:

Don't get me wrong. I can see the big picture and the amazing things that 
programmers write on Python, it's just that my question points to the lowest 
level of it's existence.


Sometimes a cigar is just a cigar.  Python is a tool, it does what you tell it.  To make 
an analogy, or maybe to clarify your philosophical view of the world, consider a hammer.  
What is the "lowest level of its existence"?

--Ned.


All You People are making this way too hard.  To understand how
questions like the OPs ought be resolved, please read:

 http://pvspade.com/Sartre/cookbook.html


Yea, I've decided we're being trolled...



  " I want to create an omelet that expresses the meaninglessness of existence,
and instead they taste like cheese. "

--
----
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Static Maps from Lat Long data in XLS file

2013-05-21 Thread Tim Daneliuk

On 05/21/2013 08:12 AM, [email protected] wrote:

Hello,

I'm new to Python, but I think it can solve my problem and I am looking for a 
someone to point me to tutorial or give me some tips here.

I have an xls file that has about 1,000 latitude and longitude points. I want 
to do one of two things: 1) Save a static maps and street view image from the 
coordinates, or 2) create an html file with the map and street view image side 
by side.

I need the urls to look like this:

Map with a pin in the centre:
http://maps.googleapis.com/maps/api/staticmap?center=43.65162,-79.40571&zoom=16&size=600x600&markers=color:blue%7Clabel:S%7C43.65162,-79.40571&sensor=false

Image:
http://maps.googleapis.com/maps/api/streetview?location=43.65162,%20-79.40571&size=600x600&sensor=false

I am not sure if option 1 will work because the url doesn't actually lead to an 
image, but rather Google returns an image when that url is used.

Any tips or pointers are much appreciated!




https://pypi.python.org/pypi/xlrd



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


Need Pattern For Logging Into A Website

2013-01-24 Thread Tim Daneliuk

I need to write a Python script to do the following:

  - Connect to a URL and accept any certificate - self-signed or authoritative
  - Provide login name/password credentials
  - Fill in some presented fields
  - Hit a "Submit" button

Why?  Because I don't want to have to start a browser and do this
interactively every time I authenticate with a particular server.
I want to do this at the command line with no interactive intervention.

I know Python pretty well.  I don't quite know how to do this and
was hoping someone had a simple pattern they could share for
doing this.

TIA,
--
--------
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Need Pattern For Logging Into A Website

2013-01-25 Thread Tim Daneliuk

On 01/25/2013 10:01 AM, Steve Petrie wrote:

On Thursday, January 24, 2013 8:29:51 PM UTC-5, Tim Daneliuk wrote:

I need to write a Python script to do the following:



- Connect to a URL and accept any certificate - self-signed or authoritative

- Provide login name/password credentials

- Fill in some presented fields

- Hit a "Submit" button



Why?  Because I don't want to have to start a browser and do this

interactively every time I authenticate with a particular server.

I want to do this at the command line with no interactive intervention.



I know Python pretty well.  I don't quite know how to do this and

was hoping someone had a simple pattern they could share for

doing this.



TIA,

--

--------

Tim Daneliuk [email protected]

PGP Key: http://www.tundraware.com/PGP/


The mechanize module (http://wwwsearch.sourceforge.net/mechanize/) might be a 
place to start.  I've done something similar with code like this:

response = mechanize.urlopen(login_form_url)
forms = mechanize.ParseResponse(response, backwards_compat=False)
response.close()
form = forms[0]   # might be more than one, though
   # fill the form
form.set_value(username, name='userName')
form.set_value(password, name='password')
   # set headers - user-agent, etc.
login_request = form.click()
login_response = mechanize.urlopen(login_request)
login_response_content = login_response.read()
...



Thanks.

--
----
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Need Pattern For Logging Into A Website

2013-01-25 Thread Tim Daneliuk

On 01/25/2013 01:18 PM, Michael Torrie wrote:

On 01/25/2013 09:18 AM, Tim Daneliuk wrote:

On 01/25/2013 10:01 AM, Steve Petrie wrote:

On Thursday, January 24, 2013 8:29:51 PM UTC-5, Tim Daneliuk
wrote: The mechanize module
(http://wwwsearch.sourceforge.net/mechanize/) might be a place to
start.  I've done something similar with code like this:

Thanks.


I've had good luck using urllib2 and a cookiejar.  Just post your login
credentials against the login url, keep all the cookies and then make
your other requests using that cookiejar.  Besides the Python standard
library docs on urllib2 and cookielib, here's an article that gives an
overview of how to use it:

http://www.techchorus.net/using-cookie-jar-urllib2

This technique has the advantage of not requiring anything outside of
the standard library.



Does it handle self-signed SSL certs?

--
--------
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Need Pattern For Logging Into A Website

2013-01-26 Thread Tim Daneliuk

On 01/26/2013 12:53 AM, Michael Torrie wrote:

On 01/25/2013 05:15 PM, Tim Daneliuk wrote:

Does it handle self-signed SSL certs?


No idea.  you'd have to try it.



OK, thanks for the pointer.

--
----
Tim Daneliuk [email protected]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Donald E. Knuth in Python, cont'd

2012-04-16 Thread Tim Daneliuk

On 04/11/2012 03:20 PM, John Nagle wrote:

On 4/11/2012 6:03 AM, Antti J Ylikoski wrote:


I wrote about a straightforward way to program D. E. Knuth in Python,
and received an excellent communcation about programming Deterministic
Finite Automata (Finite State Machines) in Python.

The following stems from my Knuth in Python programming exercises,
according to that very good communication. (By Roy Smith.)

I'm in the process of delving carefully into Knuth's brilliant and
voluminous work The Art of Computer Programming, Parts 1--3 plus the
Fascicles in Part 4 -- the back cover of Part 1 reads:

"If you think you're a really good programmer -- read [Knuth's] Art of
Computer Programming... You should definitely send me a résumé if you
can read the whole thing." -- Bill Gates.

(Microsoft may in the future receive some e-mail from me.)


You don't need those books as much as you used to.
You don't have to write collections, hash tables, and sorts much
any more. Those are solved problems and there are good libraries.
Most of the basics are built into Python.

Serious programmers should read those books, much as they should
read von Neumann's "First Draft of a Report on the EDVAC", for
background on how things work down at the bottom. But they're
no longer essential desk references for most programmers.

John Nagle


I strongly disagree with this.

There is a LOT of sloppy and incorrect code in the world because ill-taught
"programmers" do not understand the basics of algorithms, data structures,
and time/space complexity. One does not have to go to school to become so
educated, references like Knuth are timeless and still very much relevant
to the profession.

Yes, you can trust the libraries to do much, but have a mental model
for how things work with a deeper understanding of things like
the aforementioned makes a huge difference when working on your
own code.

P.S. Jon Bentley's "Programming Pearls" are also must reads for serious
programmers.

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


Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread Tim Daneliuk
On 7/12/2011 11:40 AM, John Keisling said this:
> After too much time coding Python scripts and reading Mark Lutz's
> Python books, I was inspired to write the following lyrics. For those
> too young to remember, the tune is that of "Pinball Wizard," by The
> Who. May it bring you as much joy as it brought me!
> 



You realize that you must now reprise this with,
"I'm your wicked Uncle Guido" ... right?


-- 
----
Tim Daneliuk
[email protected]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread Tim Daneliuk
On 7/12/2011 12:08 PM, Tim Daneliuk said this:
> On 7/12/2011 11:40 AM, John Keisling said this:
>> After too much time coding Python scripts and reading Mark Lutz's
>> Python books, I was inspired to write the following lyrics. For those
>> too young to remember, the tune is that of "Pinball Wizard," by The
>> Who. May it bring you as much joy as it brought me!
>>
> 
> 
> 
> You realize that you must now reprise this with,
> "I'm your wicked Uncle Guido" ... right?
> 
> 

While were on the subject:

  "T-t-t-alking 'bout my generator ...."

-- 

Tim Daneliuk
[email protected]
-- 
http://mail.python.org/mailman/listinfo/python-list


Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk
I have a task where I want to create pretty simple one page visual
interfaces (Graphical or Text, but it needs to run across Windows,
Cygwin, Linux,*BSD, OSX ...).  These interfaces are nothing more
than option checklists and text fields.  Conceptually something like:

Please Select Your Installation Options:

   Windows Compatibility Services  _
   Linux Compatibility Services_
   TRS-DOS Compatibility Services  _

   What Is Your email Address: ___

What I'm looking for is a way to describe such forms in a text
file that can then be fed into a tool to generate the necessary
pyGUI, Tkinter, (or whatever) code.   The idea is that it should
be simple to generate a basic interface like this and have it
only record the user's input.  Thereafter, the python code 
would act on the basis of those selection without any further
connection to the GUI.

An added bonus would be a similar kind of thing for generating
web interfaces to do this.  This might actually be a better model
because then I only have to worry about a single presentation
environment.

Ideas anyone?
-- 
--------
Tim Daneliuk
[email protected]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk
On 8/5/2011 2:05 PM, Irmen de Jong said this:
> On 05-08-11 19:53, Tim Daneliuk wrote:
>> I have a task where I want to create pretty simple one page visual
>> interfaces (Graphical or Text, but it needs to run across Windows,
>> Cygwin, Linux,*BSD, OSX ...).  These interfaces are nothing more
>> than option checklists and text fields.  Conceptually something like:
>>
>>  Please Select Your Installation Options:
>>
>> Windows Compatibility Services  _
>> Linux Compatibility Services_
>> TRS-DOS Compatibility Services  _
>>
>> What Is Your email Address: ___
>>
>> What I'm looking for is a way to describe such forms in a text
>> file that can then be fed into a tool to generate the necessary
>> pyGUI, Tkinter, (or whatever) code.   The idea is that it should
>> be simple to generate a basic interface like this and have it
>> only record the user's input.  Thereafter, the python code
>> would act on the basis of those selection without any further
>> connection to the GUI.
>>
>> An added bonus would be a similar kind of thing for generating
>> web interfaces to do this.  This might actually be a better model
>> because then I only have to worry about a single presentation
>> environment.
>>
>> Ideas anyone?
> 
> Yeah, HTML being the text file and a web browser being the tool to transform 
> it into a GUI...
> 
> You can hook this up with a simple web server or web framework running 
> locally to grab the submitted form results when the form is complete and 
> process them in a piece of python code.
> 
> Wouldn't that work?
> 
> 
> Irmen

Yup, although I'd probably use a central apache instance.  But
I'm still curious ... is there a way to do this with a full
GUI tool on a thick client?


-- 

Tim Daneliuk
[email protected]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk

On 8/5/2011 3:42 PM, Philip Semanchuk wrote:


On Aug 5, 2011, at 4:10 PM, Tim Daneliuk wrote:


On 8/5/2011 2:05 PM, Irmen de Jong said this:

On 05-08-11 19:53, Tim Daneliuk wrote:

I have a task where I want to create pretty simple one page visual
interfaces (Graphical or Text, but it needs to run across Windows,
Cygwin, Linux,*BSD, OSX ...).  These interfaces are nothing more
than option checklists and text fields.  Conceptually something like:

 Please Select Your Installation Options:

Windows Compatibility Services  _
Linux Compatibility Services_
TRS-DOS Compatibility Services  _

What Is Your email Address: ___

What I'm looking for is a way to describe such forms in a text
file that can then be fed into a tool to generate the necessary
pyGUI, Tkinter, (or whatever) code.   The idea is that it should
be simple to generate a basic interface like this and have it
only record the user's input.  Thereafter, the python code
would act on the basis of those selection without any further
connection to the GUI.

An added bonus would be a similar kind of thing for generating
web interfaces to do this.  This might actually be a better model
because then I only have to worry about a single presentation
environment.

Ideas anyone?


Hi Tim
This looks pretty straightforward to me; maybe I'm missing something. It 
doesn't look trivial, but the steps seem pretty clear. Is there some part in 
particular that's giving you trouble?

Cheers
Philip



I want to take a text definition file that looks something this:

  Title "Please Select Your Installation Options:"


  Checkbox  "Windows Compatibility Services"
  Checkbox  "Linux Compatibility Services"
  Checkbox  "TRS-DOS Compatibility Services"

  Inputbox   "What Is Your email Address:"


And have that aut-generate the GUI interface described above for the
selected GUI toolkit and/or an equivalent HTML page.

I know I can write a program to do this, but it seems that someone else
may have already solved this problem.

Appearance isn't terribly important.  I want a "Quick-And-Dirty" configuration
manager interface (for configuring new operating system VMs).  The reason
that I want a simple text file definition is to make it easy to add new
options to the display as they become available.  For example, suppose
it becomes possible to work with a new OS, then all I'd have to do is
add the following to the text definition file, and regenerate the interface:

  Checkbox  "MVS Compatibility Services"

The idea is to not have to touch the code base as the options of the GUI
evolve, but rather to modify the data file that describes it.  In some sense,
this is a variation of HTML templating except I want to do it (potentially)
with a thick client GUI.

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


Re: Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk

On 8/5/2011 5:51 PM, Philip Semanchuk wrote:


On Aug 5, 2011, at 6:20 PM, Tim Daneliuk wrote:


On 8/5/2011 3:42 PM, Philip Semanchuk wrote:


On Aug 5, 2011, at 4:10 PM, Tim Daneliuk wrote:


On 8/5/2011 2:05 PM, Irmen de Jong said this:

On 05-08-11 19:53, Tim Daneliuk wrote:

I have a task where I want to create pretty simple one page visual
interfaces (Graphical or Text, but it needs to run across Windows,
Cygwin, Linux,*BSD, OSX ...).  These interfaces are nothing more
than option checklists and text fields.  Conceptually something like:

 Please Select Your Installation Options:

Windows Compatibility Services  _
Linux Compatibility Services_
TRS-DOS Compatibility Services  _

What Is Your email Address: ___

What I'm looking for is a way to describe such forms in a text
file that can then be fed into a tool to generate the necessary
pyGUI, Tkinter, (or whatever) code.   The idea is that it should
be simple to generate a basic interface like this and have it
only record the user's input.  Thereafter, the python code
would act on the basis of those selection without any further
connection to the GUI.

An added bonus would be a similar kind of thing for generating
web interfaces to do this.  This might actually be a better model
because then I only have to worry about a single presentation
environment.

Ideas anyone?


Hi Tim
This looks pretty straightforward to me; maybe I'm missing something. It 
doesn't look trivial, but the steps seem pretty clear. Is there some part in 
particular that's giving you trouble?

Cheers
Philip



I want to take a text definition file that looks something this:

  Title "Please Select Your Installation Options:"


  Checkbox  "Windows Compatibility Services"
  Checkbox  "Linux Compatibility Services"
  Checkbox  "TRS-DOS Compatibility Services"

  Inputbox   "What Is Your email Address:"


And have that aut-generate the GUI interface described above for the
selected GUI toolkit and/or an equivalent HTML page.

I know I can write a program to do this, but it seems that someone else
may have already solved this problem.


Oh, I see. I didn't realize you were looking for a most canned solution. I 
agree that it's a problem that's been solved many times.

I've used Mako before as an HTML templating engine, but ISTR that it points out 
that it's agnostic to what it's templating. In other words, it only cares about 
what's between the Mako escape tags, it doesn't care if the surrounding text is 
HTML or XML or Python or whatever.

So you could have a Mako template that consists mostly of Python code that 
builds a wxPython window (if wxPython is your cup of tea) and then some Mako 
commands in the middle that reads your text definition file and adds 
checkboxes, textboxes, etc. as appropriate. It's not a canned solution, but it 
does allow you to separate the boilerplate stuff from the variants.

Hope this helps
Philip



Something like this is more what I had in mind (but this seems to
not be actively supported):

http://pythoncard.sourceforge.net/documentation.html

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


Re: Old Man Yells At Cloud

2017-09-16 Thread Tim Daneliuk
On 09/16/2017 12:38 AM, Steve D'Aprano wrote:
> /rant on
> 
> So apparently everyone who disagrees that Python should be more like 
> Javascript
> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids --
> and is also too stupid to know how dumb they are.
> 
> "Hi, I've been programming in Python for what seems like days now, and here's
> all the things that you guys are doing wrong. I insist that you fix them
> immediately, it doesn't matter how much code it will break, that's not
> important. What is important is that Javascript programmers like me shouldn't
> be expected to learn anything new or different when they program with Python."
> 
> /rant off
> 
> And no, for once it wasn't Ranting Rick.
> 
> 
> 
> 

Well, the whole integer floor division thing years ago was the beginning
of the end - Python was doomed ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Old Man Yells At Cloud

2017-09-16 Thread Tim Daneliuk
On 09/16/2017 12:38 AM, Steve D'Aprano wrote:
> /rant on
> 
> So apparently everyone who disagrees that Python should be more like 
> Javascript
> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids --
> and is also too stupid to know how dumb they are.
> 
> "Hi, I've been programming in Python for what seems like days now, and here's
> all the things that you guys are doing wrong. I insist that you fix them
> immediately, it doesn't matter how much code it will break, that's not
> important. What is important is that Javascript programmers like me shouldn't
> be expected to learn anything new or different when they program with Python."
> 
> /rant off
> 
> And no, for once it wasn't Ranting Rick.
> 
> 
> 
> 

Well, the whole integer floor division thing years ago was the beginning
of the end - Python was doomed ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Daneliuk
On 09/16/2017 09:59 AM, Tim Daneliuk wrote:
> On 09/16/2017 12:38 AM, Steve D'Aprano wrote:
>> /rant on
>>
>> So apparently everyone who disagrees that Python should be more like 
>> Javascript
>> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids 
>> --
>> and is also too stupid to know how dumb they are.
>>
>> "Hi, I've been programming in Python for what seems like days now, and here's
>> all the things that you guys are doing wrong. I insist that you fix them
>> immediately, it doesn't matter how much code it will break, that's not
>> important. What is important is that Javascript programmers like me shouldn't
>> be expected to learn anything new or different when they program with 
>> Python."
>>
>> /rant off
>>
>> And no, for once it wasn't Ranting Rick.
>>
>>
>>
>>
> 
> Well, the whole integer floor division thing years ago was the beginning
> of the end - Python was doomed ...
> 


Ummm  I was KIDDING via hyperbole ... sheesh ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Templating Language

2017-12-16 Thread Tim Daneliuk
On 12/17/2017 12:41 AM, Abdur-Rahmaan Janhangeer wrote:
> Hi all,
> 
> Can somebody point out to me some py-based template languages interpreters
> resources?
> 
> Thank you !
> 

http://jinja.pocoo.org/

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


Re: Grumpy: Python to Go compiler

2017-01-08 Thread Tim Daneliuk
On 01/08/2017 06:18 PM, Deborah Swanson wrote:
> (haha, unless
> you ask)

C'mon, go for it ... there hasn't been a good rant here in
4 or 5 minutes ...


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


Re: How coding in Python is bad for you

2017-01-23 Thread Tim Daneliuk
On 01/23/2017 11:24 AM, [email protected] wrote:
> The article is here http://lenkaspace.net/index.php/blog/show/111
> 
> Kindest regards.
> 
> Mark Lawrence.
> 

Beyond silly.  Languages - like all tools - can be used properly or badly.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How coding in Python is bad for you

2017-01-23 Thread Tim Daneliuk
On 01/23/2017 02:19 PM, Chris Angelico wrote:
> On Tue, Jan 24, 2017 at 6:59 AM, Grant Edwards
>  wrote:
>> On 2017-01-23, [email protected]  wrote:
>>
>>> The article is here http://lenkaspace.net/index.php/blog/show/111
>>
>> I don't really think any of his points are valid, but one way that
>> programming in Python is bad for you:
>>
>>  * It reduces your tolerance for progamming in PHP zero.  If you end
>>up assigned to a PHP project, you end up miserable and unpleasant
>>to work with or just plain unemployed.
> 
> I believe that's "bad for you" in the sense that chocolate is bad for you.
> 
> It isn't.
> 
> ChrisA
> 


It's bad for you in the same sense tha chocolate is bad for you - if you
melt it and pour it into your ears...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thank you Python community!

2018-03-19 Thread Tim Daneliuk
On 03/19/2018 02:05 PM, bartc wrote:
> I've often wondered what the guys who invented C (around 1970) must have been 
> smoking to have come up with some of those ideas.

I dunno, but I do know that - if they were smoking something - it was
rolled in greenbar paper ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP 526 - var annotations and the spirit of python

2018-07-02 Thread Tim Daneliuk
On 07/01/2018 12:17 PM, MRAB wrote:
> On 2018-07-01 18:06, Abdur-Rahmaan Janhangeer wrote:
>> was viewing pep526, so, finally, python cannot do without hinting the type
>> as other languages?
>> will python finally move to
>> int x = 3 where int is a pre annotation?
>>
>> i am not arguing it's usefulness but rather, does it fit with python?
>>
> PEP 526 says that the annotation would be:
> 
> x: int = 3
> 
> It also says """It should also be emphasized that Python will remain a 
> dynamically typed language, and the authors have no desire to ever make type 
> hints mandatory, even by convention.""



This strikes me as syntactic noise.  Python is dynamically typed and will 
remain so.
Why clutter the language - even optionally - with stuff like this?


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


Re: PEP 526 - var annotations and the spirit of python

2018-07-02 Thread Tim Daneliuk
On 07/02/2018 06:22 PM, Gregory Ewing wrote:
> A
> truly good programmer will be able to learn about the language
> being used on the job.

Except that the current attempt is to use techniques like agile,
scrum, pair programming, and so forth to turn programming into
a factory activity.  High degrees of specialization are segmented
by architectural role (front end, back end, infrastructure,
DevOps ...), language, and even business unit.  In my view,
systems architecture, software design, and non functional
capabilities suffer thereby, but I am old and crabby :)

In particular, there is little interest in having programmers
learn on the job, only that they be as productive as possible
as fast they can.   Hiring specific languages skills - the theory
goes - means that the individual will be fluent in the entire
language ecosystem of libraries, tools, and so forth.  What gets
lost in this factory model is that fewer and fewer people are able
to stand back and ask, "Are we even using a good design, language,
toolkit, ..."

While it is true that a good programmer will pick up new things
out of personal curiosity, it is also true that this is not
as rewarded a behavior as we'd like to believe.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido van Rossum resigns as Python leader

2018-07-14 Thread Tim Daneliuk
On 07/14/2018 10:16 AM, Skip Montanaro wrote:
>> Is it irrational to wonder whether projects should be looking to migrate to
>> new languages? This kind of announcement makes me worry for the future.
> 
> Umm, yeah. The language is stable, widely used packages are stable.
> Guido actually has little involvement in the larger Python ecosystem.
> It's not like NumPy, Django, Pandas, Flask, PyPI, Conda, or other
> popular packages or subsystems built with/for Python are suddenly
> going to crumble because Guido is no longer BDFL.
> 
> But, by all means, if rewriting your applications in a different
> language floats your boat, go right ahead...
> 
> Skip
> 

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


Re: Cult-like behaviour [was Re: Kindness]

2018-07-14 Thread Tim Daneliuk
On 07/14/2018 04:09 AM, Christian Gollwitzer wrote:
> I agree with this observation and it feels quite strange to me. I regularly 
> use three languages (C++, Python and Tcl), all three are under active 
> development, and IMHO all of them have flaws, there are is always something 
> which is elegantly solved in one system but needs more work in another.


Dusting off some of my musings written years ago but at least tangentially
related to all this:

   https://www.tundraware.com/TechnicalNotes/How-To-Pick-A-Programming-Language/
   https://www.tundraware.com/TechnicalNotes/Bullet/

I am not particularly enamored of the feeping creaturism that that infested
Python 3, but then again, I'm not required by law to use said feeping 
creatures...

I wish GvR well.  He's served this community magnificently and deserves far
better than he got, especially lately. := pedantry aside (and I am NOT a fan),
great things come from individual minds, not committees and I think it is
simply inarguable that GvR built a Very Great Thing.  So ... thanks ... and
go enjoy your life, sir, you've more than earned it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cult-like behaviour [was Re: Kindness]

2018-07-15 Thread Tim Daneliuk
On 07/14/2018 07:40 PM, Chris Angelico wrote:
> You'd better avoid most of JavaScript, C++, and most other languages,
> then. Every language feeps a little, and Python is definitely not as
> bad as some.

Point Of Order: C++ is one gigantic feep to be avoided at all costs... :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ESR "Waning of Python" post

2018-10-12 Thread Tim Daneliuk
On 10/11/2018 12:15 AM, Gregory Ewing wrote:
> Paul Rubin wrote [concerning GIL removal]:
>> It's weird that Python's designers were willing to mess up the user
>> language in the 2-to-3 transition but felt that the C API had to be kept
>> sarcosanct.  Huge opportunities were blown at multiple levels.
> 
> You say that as though we had a solution for GIL removal all
> thought out and ready to go, and the only thing that stopped us
> is that it would have required changing the C API.
> 
> But it's not like that at all. As far as I know, all the
> attempts that have been made so far to remove the GIL have
> led to performance that was less than satisfactory. It's a
> hard problem that we haven't found a good solution to yet.
> 


Do you happen to have a reference that explains what the issues are
for GIL removal?


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


Re: ESR "Waning of Python" post

2018-10-12 Thread Tim Daneliuk
On 10/12/2018 11:43 AM, Skip Montanaro wrote:
> I sort of skimmed ESR's post, and sort of skimmed this thread, so
> obviously I'm totally qualified to offer my observations on the post
> and follow ups. :-)

Skip -

In the 15-ish years I've been reading this group, this has NEVER been
an obstacle for posters :P

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


Re: Accessing clipboard through software built on Python

2018-10-28 Thread Tim Daneliuk
On 10/27/2018 08:17 AM, Musatov wrote:
> I am wondering if Python could be used to write a program that allows:
> 
> 1. Highlight some text
> 2. Ctl+HOTKEY1 stores the string of text somewhere as COPIEDTEXT1
> 3. Highlight another string of text
> 4. Ctl+HOTKEY1 stores another string of text somewhere as COPIEDTEXT2
> 
> THEN
> 
> 5. Ctl+HOTKEY2 pastes COPIEDTEXT1
> 6. Ctl+HOTKEY2 pastes COPIEDTEXT2
> 
> I found "pyperclip" and "Tkinter" but I don't know where to start.
> 
> Thanks,
> 
> Musatov
> 


I am able to do this with clipboard (pip install clipboard).


However, the highlighted text must be copied explicitly:

Highlight
Ctl-C

In Python:

TEXT1 = clipboard.paste()

Highlight again

TEXT2 = clipboard.paste()

X actually has several clipboard buffers and it can be tricky to get this 
going.  I don't recall,
but either clipboard or pyperclip have a way to get to them all IIRC ...

HTH,
-Tim

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


Re: Accessing clipboard through software built on Python

2018-10-28 Thread Tim Daneliuk
On 10/28/2018 02:08 PM, Akkana Peck wrote:
> Tim Daneliuk writes:
>> However, the highlighted text must be copied explicitly:
>>
>> Highlight
>> Ctl-C
> [ ... ]
>> X actually has several clipboard buffers and it can be tricky to get this 
>> going.  I don't recall,
>> but either clipboard or pyperclip have a way to get to them all IIRC ...
> 
> To get the highlighted text in X without needing a copy, you want the
> PRIMARY X selection rather than CLIPBOARD.
> 
> I think pyperclip can get it (it uses an external program like xsel,
> and xsel can get any of the three X selections), or you can get the
> selection using a GUI library like GTK, Qt or Tk. Some examples:
> https://github.com/akkana/scripts/blob/master/pyclip
> 
> ...Akkana
> 


Yes, that sounds right in the distant recesses of my memory :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Accessing clipboard through software built on Python

2018-10-28 Thread Tim Daneliuk
On 10/28/2018 02:08 PM, Akkana Peck wrote:
> Tim Daneliuk writes:
>> However, the highlighted text must be copied explicitly:
>>
>> Highlight
>> Ctl-C
> [ ... ]
>> X actually has several clipboard buffers and it can be tricky to get this 
>> going.  I don't recall,
>> but either clipboard or pyperclip have a way to get to them all IIRC ...
> 
> To get the highlighted text in X without needing a copy, you want the
> PRIMARY X selection rather than CLIPBOARD.
> 
> I think pyperclip can get it (it uses an external program like xsel,
> and xsel can get any of the three X selections), or you can get the
> selection using a GUI library like GTK, Qt or Tk. Some examples:
> https://github.com/akkana/scripts/blob/master/pyclip
> 
> ...Akkana
> 


Yes, that sounds right in the distant recesses of my memory :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Lifetime of a local reference

2019-02-26 Thread Tim Daneliuk
On 2/26/19 3:54 PM, Marko Rauhamaa wrote:
> Consider this function:
> 
> def fun():
> f = open("lock")
> flock.flock(f, fcntl.LOCK_EX)
> do_stuff()
> sys.exit(0)
> 
> Question: can a compliant Python implementation close f (and,
> consequently, release the file lock) before/while do_stuff() is
> executed?
> 
> I couldn't find an immediate answer in the documentation.


Not quite sure what you are asking.  Are you asking if the file handle
can be closed before (or concurrently if do_stuff() is a thread) and
do_stuff() can continue to make use of the handle?

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


Re: join and split with empty delimiter

2019-07-17 Thread Tim Daneliuk
On 7/17/19 4:24 PM, Chris Angelico wrote:
> Agreed. There are a number of other languages where splitting on an
> empty delimiter simply fractures the string into characters (I checked
> Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful
> feature. +1.

Not only that, it makes the language more symmetric/consistent. Put
me down for +1 as well.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 1:20 PM, Chris Angelico wrote:
> On Sun, Jul 21, 2019 at 4:13 AM Michael Speer  wrote:
>>
>> You may want to use `#!/usr/bin/env python3` instead.
>>
>> There is a concept in python called the virtual environment. This used to
>> be done with a tool called virtualenv in python2, and is now done mainly
>> through a venv module in python3.
>>
>> A virtual environment goes into a directory of your choosing and will have
>> its own python3 executable, and pip3 executable, and when you add
>> dependencies, they are also placed into the directory structure under your
>> chosen directory.
>>
>> When you do a `. /bin/activate` the included source will places
>> the virtual environment's bin/ folder at the beginning of your PATH
>> environment variable, making it the default python3 when you type it
>> without a full path.
>>
>> This allows you to run scripts that need different, or even conflicting,
>> sets of dependencies without bothering with the underlying linux
>> distribution's python installation's modules.
>>
>> If you use `#!/usr/bin/python3`, it will always use exactly the system
>> version that is installed, and the system's installed modules.
>>
>> Your scripts will still default to the system installation if a virtual
>> environment is not activated. So you lose nothing by doing it this way, but
>> gain a little control from it.
>>
> 
> ONLY if you actually want this script to behave differently inside a
> venv. When you're setting a shebang on a script, you often do not want
> that. You potentially LOSE a lot of control.
> 
> ChrisA

Disagree strongly.  The environment should always define where you want to find 
key
binaries, whether in a venv or not.  There are many use cases where you want to
override system binaries.  For example, you may be running on an older OS 
release
and want to point to a newer one installed elsewhere.  Similarly, the DevOps 
workflow
may demand particular configurations for the pipelines to run properly.

I have spent way too much time in my career trying to undo this kind of 
imperious
programming that thinks the coder knows best, when in the actual runtime 
environment,
they actually don't.  Most recently, I have been working to produce a 
configuration
for linuxbrew that can be installed by an unprivileged user at any location 
they like.
It is maddening to spend hours getting things working only to find out that 
some genius
decided that the only version of, say, perl or autoconf, is to be found 
exclusively in
/usr/bin.

So, no, do NOT encode the hard location - ever.  Always use env to discover the 
one that
the user has specified.  The only exception is /bin/sh which - for a variety of 
reasons -
can reliably counted upon.

We don't need to bikeshed this.  All we need is people who disagree with this 
view to spend
a year in software packaging, operations, deployment and DevOps ... then get 
back to us...

Grr..

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


Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 2:56 PM, Peter J. Holzer wrote:
> On 2019-07-20 14:11:44 -0500, Tim Daneliuk wrote:
>> So, no, do NOT encode the hard location - ever.  Always use env to
>> discover the one that the user has specified.  The only exception is
>> /bin/sh which - for a variety of reasons - can reliably counted upon.
>>
>> We don't need to bikeshed this.  All we need is people who disagree
>> with this view to spend a year in software packaging, operations,
>> deployment and DevOps ... then get back to us...
>
> After 25 years in software packaging, operations, deployment and DevOps
> I disagree: A program should not behave differently because of a
> different path, #!/usr/bin/env is a total no-no.
>
> There is a nice way to achieve this: Just use the interpreter of the
> virtual environment in the shebang.
> (That requires rewriting the shebang during installation, but that's a
> minor inconvenience)
>
> hp
>



And what happens with programs that have no virtenv equivalent?
perl, go, ruby, awk, sed, grep, etc. have no simple way to
get installed virtual short of insisting the everything live in a
docker container or VM?

The fact is that most large compute environments are slow to upgrade
the OS.  That means core tools also lag considerably behind as well.
Being able to install newer versions along side the OS' own and then
use them by default is manifestly necessary.  That's why users have
the ability to modify $PATH to suit their own needs.  All /usr/bin/env
does is to tell the interpreter, "honor the intent of the spawning shell".
This shouldn't even be a question ... and it's why so much garbage continues
to live forever.  Having to constantly code around old systems versions of
tools with not other recourse is just crazy.

In actual fact, the very best way to write portable, reliable, and operable
systems of code is to divorce them entirely (or as a nearly as possible) for
the OS tools as you can.  That's why docker works so well.  That's why go
avoids dynamic linking.

In my case, that's why I compile my own version of
languages and daily use utilities to live outside the OS.  I get absolutely
predicable behavior irrespective of my distro and whatever backleveled cruft
it has laying around.   I _know_ every version of every important tool my code
will be using ... all by setting up $PATH properly and using /usr/bin/env in
my interpreters.

If you want really big fun, try going into an older CentOS or RedHat instances 
and, say,
upgrading system python to python3.  It's super fun.  Yes, in that case, you 
COULD
use a venv.  But there are tons of other tools for which this is not an option -
gcc, autoconf, perl, go awk, sed, bash, ad infinitum, ad nauseum are invariably
backleveled on production OS instances.  My way fixes that problem.  Your way
forces me to code around it ... which is a way worse solution.

You may have 25 years at this but I have 40 - does that make me nearly twice
as right?  Arguments from authority are silly.

P.S. https://www.tundraware.com/TechnicalNotes/Divorce-Your-Linux-Admin/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 5:14 PM, Chris Angelico wrote:
> Using env for everything is a terrible idea and one that
> will basically make virtual environments useless.

Not if you manage them properly.

Everyone's mileage is different, but when I enter a venv, I ensure everything I 
do
there is packaged to work together.  I pip install things in there and ensure
that the tools I invoke will work in that environment.

In the example you cite, I would simply run the tools in question outside any
environment where I know they don't work.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 5:47 PM, Tim Daneliuk wrote:
> On 7/20/19 5:14 PM, Chris Angelico wrote:
>> Using env for everything is a terrible idea and one that
>> will basically make virtual environments useless.
> 
> Not if you manage them properly.
> 
> Everyone's mileage is different, but when I enter a venv, I ensure everything 
> I do
> there is packaged to work together.  I pip install things in there and ensure
> that the tools I invoke will work in that environment.
> 
> In the example you cite, I would simply run the tools in question outside any
> environment where I know they don't work.
> 

I guess I should clarify something:

1) I pip install everything locally inside my own $HOME for that set of things 
I need
   generally and will not be using in a venv.

2) I pip install everything I need in each venv, even if it already exists 
under 1) above.

I effectively treat venvs as fully self-contained environments to the degree 
possible.


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


Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 6:04 PM, Chris Angelico wrote:
> Are you aware of every systemwide command that happens to be
> implemented in Python, such that you won't execute any of them while
> you have the venv active?

No, but this has never been a problem because the newer versions of
python tend to be pretty good - within a major release tree - of being
backward compatible.  Certainly, if I were running, say, RedHat 4 with
a very new version of python in my path first, this could theoretically
be an issue.  I've just not run into it.


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


Re: Proper shebang for python3

2019-07-20 Thread Tim Daneliuk
On 7/20/19 6:04 PM, Cameron Simpson wrote:
> If you require a specific outcoming, set a specific environment. It is under 
> your control. Control it.

Exactly right.  I have just had the REALLY irritating experience of trying to 
bootstrap a
location insensitive version of linuxbrew that mostly works, but is crippled by 
brain damage
that insists that the best version of perl will always be found in /usr/bin.

I have been a hardware engineer (analog and digital), software implementor, 
systems designer,
devops person, and large scale (physical data center) platform engineer and 
this kind of
bad thinking just kills site reliability.

I stipulate that there are corner cases where Chris A. is correct - it is 
certainly
possible to clobber a system with incorrect /usr/bin/env findings.   But I'd 
argue
that there is a simple work around - run another terminal session (terminator, 
tmux,
screen, ... whatever floats your boat) that has $PATH set up to find things in 
/usr/bin
first.  Voila! Problem solved and everyone can use env the way they want to.

In some respects, this problem does get a little simpler when you docker-ize 
your
software distributions until ... you need newer versions of tools than even the 
latest
docker OS implementations support.  Then you're back to the same old noise ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proper shebang for python3

2019-07-21 Thread Tim Daneliuk
On 7/21/19 8:47 AM, Peter J. Holzer wrote:
> That's fine. Unlike Tim I don't claim that anybody who disagrees with me
> must be a newbie.

Peter, that's ad hominem and unfair.  I never said anything close to that.
What I said is that if someone were to spend an extended period of time
in devops and systems engineering at large scale, they'd quickly come to
hate hardwired paths.

The truth is that there is no single answer to this problem until you
hermetically seal an environment.  Docker comes close, a freestanding
VM does this most completely.   But short of that, the ability to decide
to use something other than system-provided tools absolutely IS a requirement
in systems of any scale.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proper shebang for python3

2019-07-22 Thread Tim Daneliuk
On 7/20/19 4:28 PM, Brian Oney wrote:
> Why not make a compromise? What would be a potential pitfall of the
> following spitbang?
> 
> #!python

Not sure this really changes the discussion.
-- 
https://mail.python.org/mailman/listinfo/python-list


Randomizing Strings In A Microservices World

2019-12-09 Thread Tim Daneliuk
I ran across a kind of fun problem today that I wanted to run past you Gentle 
Geniuses (tm):

- Imagine an environment in which there may be multiple instances of a given
  microservice written in Python.

- Each of these services needs to produce a string of ten digits guaranteed to 
be unique
  on a per service instance basis AND to not collide for - oh, let's say - 
forever :)s

Can anyone suggest a randomization method that might achieve this efficiently?

My first thought was to something like nanonseconds since the epoch plus 
something
unique about the service instance - like it's IP?  (This is in a K8s cluster) - 
to
see the randomization and essentially eliminate the string being repeated.

Ideas welcome ..

P.S. I do not want to resort to a number generation service that each instance 
asks
 for a new number.  The network and service call overhead militates against 
this
 in my application.

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


Re: Randomizing Strings In A Microservices World

2019-12-09 Thread Tim Daneliuk
On 12/9/19 8:50 PM, Paul Rubin wrote:
> Tim Daneliuk  writes:
>> - Imagine an environment in which there may be multiple instances of a given
>>   microservice written in Python.
> 
> Decide the maximum number of microservice instances, say 1000.  Chop up
> the 10 digit range into 1000 pieces, so 0..99, 100-199, etc.
> Give one range to each microservice instance.  Then have the
> microservices give out the numbers sequentially, but treating them as 10
> digit numbers and encrypting each one under a 10 digit pseudorandom
> permutation shared by all the instances.  Look up "format preserving
> encryption" for how to do this.
> 
> Obvious variants of the above are obvious, and maybe you need some way
> to hand around chunks of range if some instance gives out more than a
> million numbers.
> 


The problem here is that the services are ephemeral and the number of said
services is not fixed.

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


Re: Randomizing Strings In A Microservices World

2019-12-09 Thread Tim Daneliuk
On 12/9/19 8:54 PM, Dennis Lee Bieber wrote:
> On Mon, 9 Dec 2019 18:52:11 -0600, Tim Daneliuk 
> declaimed the following:
> 
>>
>> - Each of these services needs to produce a string of ten digits guaranteed 
>> to be unique
>>  on a per service instance basis AND to not collide for - oh, let's say - 
>> forever :)s
>>
>> Can anyone suggest a randomization method that might achieve this 
>> efficiently?
>>
>> My first thought was to something like nanonseconds since the epoch plus 
>> something
>> unique about the service instance - like it's IP?  (This is in a K8s 
>> cluster) - to
>> see the randomization and essentially eliminate the string being repeated.
>>
>> Ideas welcome ..
>>
> 
>   Well, 10 digits is rather short, but studying
> https://en.wikipedia.org/wiki/Universally_unique_identifier might provide
> some ideas.
> 
> 

For a variety of reasons the length of this string cannot exceed 10 digits.  It 
is believed
that - in this application - the consumption of values will be sparse over 
time.  All
I really need is a high entropy way to select from among the billion possible 
values to
minimize the possibility of collisions (which require retry and time we don't 
want to burn).

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


Re: Randomizing Strings In A Microservices World

2019-12-10 Thread Tim Daneliuk
On 12/10/19 10:36 AM, Peter Pearson wrote:
> Just to be sure: you *are* aware that the "Birthday Paradox" says
> that if you pick your 10-digit strings truly randomly, you'll probably
> get a collision by the time of your 10**5th string . . . right?

I did not consider this, but the point is taken.

Could you kindly point me to a source for calculating this given
n-digit numeric-only strings?

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


Re: Randomizing Strings In A Microservices World

2019-12-15 Thread Tim Daneliuk
On 12/10/19 12:37 PM, Chris Angelico wrote:
> On Wed, Dec 11, 2019 at 5:01 AM Tim Daneliuk  wrote:
>>
>> On 12/10/19 10:36 AM, Peter Pearson wrote:
>>> Just to be sure: you *are* aware that the "Birthday Paradox" says
>>> that if you pick your 10-digit strings truly randomly, you'll probably
>>> get a collision by the time of your 10**5th string . . . right?
>>
>> I did not consider this, but the point is taken.
>>
>> Could you kindly point me to a source for calculating this given
>> n-digit numeric-only strings?
>>
> 
> The exact formula is pretty gnarly, but you can get remarkably close
> by assuming that you're likely to get a collision at the square root -
> which is half the exponent (so a 16-bit checksum will collide after
> about 2**8 examples, and a 128-bit UUID4 will collide after about
> 2**64 UUIDs are generated).
> 
> https://en.wikipedia.org/wiki/Birthday_problem
> 
> ChrisA
> 


Close enough for my purposes.  Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Lists And Missing Commas

2019-12-23 Thread Tim Daneliuk
If I do this:

foo = [ "bar", "baz" "slop", "crud" ]

Python silently accepts that and makes the middle term "bazslop".

BUT, if I do this:

foo = [ "bar", "baz" 1, "crud" ]

or this:

foo = [ "bar", 2 1, "crud" ]

The interpreter throws a syntax error.

This is more of an intellectual curiosity than anything else, but why do 
strings silently
concatenate like that, while all other case blow up with an error.  i.e., What 
is about
the language the promotes this behavior.  At first blush, it seems 
inconsistent, but what
do I know ...




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


Re: Lists And Missing Commas

2019-12-23 Thread Tim Daneliuk
On 12/23/19 7:52 PM, DL Neil wrote:
> 
> WebRef: https://docs.python.org/3/reference/lexical_analysis.html


Yep, that explains it, but it still feels non-regular to me.  From a pointy 
headed academic
POV, I'd like to see behavior consistent across types. Again ... what do I know?

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


Re: Lists And Missing Commas

2019-12-23 Thread Tim Daneliuk
On 12/23/19 8:35 PM, Chris Angelico wrote:
> On Tue, Dec 24, 2019 at 12:56 PM DL Neil via Python-list
>  wrote:
>> However, your point involves the fact that whereas:
>>
>> 1 + 2   # 3 is *clearly* addition, and
>> "a" + "b"   # "ab" is *clearly* concatenation
>>
>> "a" "b" # also evaluates to "ab"
>>
>> and is thus, concatenation without any explicit infix operator! Just one
>> cotton-picking minute - what's going on here?
> 
> 1_2# Clearly concatenation. Right?
> 0_0# Clearly an emoticon
> 
> Just another cotton-picking minute..
> 
> ChrisA
> 

You are excused and required to do 30 days penance writing .NET.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Lists And Missing Commas

2019-12-24 Thread Tim Daneliuk
On 12/24/19 6:37 AM, Stefan Ram wrote:
>  And you all are aware that this kind of string concatenation
>   happens in C and C++, too, aren't you?
> 
>   main.c
> 
> #include 
> int main( void ){ puts( "a" "b" ); }
> 
>   transcript
> 
> ab

Noting that it has been a long time since I looked at the C specification ...

Is the above an artifact of how puts() is implemented or is it innate in the 
language spec?
-- 
https://mail.python.org/mailman/listinfo/python-list


3.8.5 Failing To Install With pythonz

2020-08-09 Thread Tim Daneliuk
I have a weird problem I could use a bit of help with ...

I have successfully installed 3.8.5 using pew/pythonz on a BSD FreeBSD system.
But when I attempt to install it on a Linux system I get the traceback below.
In this case, pew/pythonz were installed locally in my own account using system
native python 3.6:

Installing CPython-3.8.5 into /home/tundra/.pythonz/pythons/CPython-3.8.5
Traceback (most recent call last):
  File 
"/home/tundra/.local/lib/python3.6/site-packages/pythonz/installer/pythoninstaller.py",
 line 204, in install
self.make()
  File 
"/home/tundra/.local/lib/python3.6/site-packages/pythonz/installer/pythoninstaller.py",
 line 350, in make
s.check_call(make)
  File "/home/tundra/.local/lib/python3.6/site-packages/pythonz/util.py", line 
294, in check_call
returncode = self.call(cmd)
  File "/home/tundra/.local/lib/python3.6/site-packages/pythonz/util.py", line 
286, in call
fp.write(line)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 
81: ordinal not in range(128)
ERROR: Failed to install CPython-3.8.5. Check 
/home/tundra/.pythonz/log/build.log to see why.
Traceback (most recent call last):
  File "/home/tundra/.local/bin/pew", line 11, in 
sys.exit(pew())
  File "/home/tundra/.local/lib/python3.6/site-packages/pew/pew.py", line 809, 
in pew
return command(sys.argv[2:])
  File "/home/tundra/.local/lib/python3.6/site-packages/pew/pew.py", line 704, 
in install_cmd
return actual_installer.install()
  File 
"/home/tundra/.local/lib/python3.6/site-packages/pythonz/installer/pythoninstaller.py",
 line 204, in install
self.make()
  File 
"/home/tundra/.local/lib/python3.6/site-packages/pythonz/installer/pythoninstaller.py",
 line 350, in make
s.check_call(make)
  File "/home/tundra/.local/lib/python3.6/site-packages/pythonz/util.py", line 
294, in check_call
returncode = self.call(cmd)
  File "/home/tundra/.local/lib/python3.6/site-packages/pythonz/util.py", line 
286, in call
fp.write(line)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 
81: ordinal not in range(128)


Ideas anyone?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/17/20 1:26 PM, Chris Angelico wrote:
> For context, see this commit:
> 
> https://github.com/python/peps/commit/0c6427dcec1e98ca0bd46a876a7219ee4a9347f4
> 
> The commit message is highly politically charged and is now a
> permanent part of the Python commit history. The Python Steering
> Council has this to say:
> 
> https://github.com/python/steering-council/issues/34#issuecomment-675028005
> 
> "The SC discussed this and ... we do not deplore the message."
> 
> So now we know: go ahead and put all the political messages you like
> into the commit messages, just don't put anything inappropriate into
> the content. White supremacy has been mentioned; who wants to pick the
> next hot topic?
> 
> ChrisA
> 
Just a few thoughts here ...

- While languages evolve over time, _in any given moment_ there are better
  and worse ways to express ideas in a given language. "The Elements Of Style"
  remains relevant today because it provides guidance on improving
  written clarity.  It is not some blind defence of the
  perfect English.

- Precision of language and precision of thought go hand in hand.  Much
  of the grousing about languages standards (in this case, hiding in
  drag as social consciousness) is little more than intellectual laziness.
  In actual fact, our discipline has burned a lot of intellectual
  fuel in trying to find ways to be _more precise_ for things like
  specifications, formal semantics, and the like.

- It is my consistent experience when working with non-native English
  speakers, that they wish to _improve_ their use and precision of the
  language, not simplify it.

- Why is English the only target of these social pieties?  You never
  hear these demands to relax these linguistic standards for, say, French,
  German, or Spanish.  Similarly, where is the outcry to make
  Mandarin, Bantu, Swahili, or Arabic more approachable for
  Westerners?

Methinks there is an ideological skunk in the parlor ...


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


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/18/20 12:28 PM, justin walters wrote:
> I apologize for being ageist earlier as well. That was out of line.

I am likely older than you and there is no reason to apologise.
Only the profoundly undeveloped psyche takes every opportunity to
find offense when  none is intended.  It is the sign of a puerile
mind, irrespective of actual chronological age.  Feel free to be
as "ageist" as you wish ... only make it funny or biting ...

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


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/18/20 6:34 PM, [email protected] wrote:
> I would kindly recommend that folks just educate themselves on what


I would also like to help you become educated.  Be sure to check
out these literary treasures - they are the foundation of the
worldview you are espousing:


The_Origin of the Family, Private Property, and the State - Engels

Das Kapital - Marx

On Guerrilla Warfare - Mao

Your claims to virtue are a fraud.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/18/20 6:34 PM, [email protected] wrote:
> I would kindly recommend that folks just educate themselves on what

Speaking of being educated ...  Could you please do an exposition
for all us ignorant types on the books that really animate
your worldview:


The_Origin of the Family, Private Property, and the State - Engels

Das Kapital - Marx

On Guerrilla Warfare - Mao

There are many noble causes for which to fight.  Yours isn't one of them.

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


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 8:35 AM, Alexandre Brault wrote:
> I've not seen anyone objecting to the idea of removing the reference to 
> Strunk and White in favour of the underlying message of "be understandable by 
> others who may read your comments" (there were at most a few philosophical 
> "what is understandable") . In fact, that is how the topic was initially 
> presented.
> 
> What people *are* complaining about is the use of a commit message to stand 
> on a soapbox and preach. The time to preach was when debating the change; 
> commit messages, in many people's opinions, is not the time to espouse 
> non-technical opinions

I would argue that these highly polarizing political discussions never have
a place at any point in the lifecycle of technology improvement.  Once you
open this door in any way, no end of mischief ensues.

You already see this in this very thread.  People are determined to flog
their particular political theory, virtue signal, and generally misappropriate
a technical forum to their own ends.

The right answer here is: No politics, no social commentary, no demands for
redress of perceived historical inequities ... none of that.  The sole relevant
demand should be civility.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/18/20 12:18 PM, gia wrote:
>  That's why I picked Math, it is also universally accepted, it's very
> strict, and it leaves the reader to decide its color based on themselves
> (it's not white btw :)


Sorry, but when it comes to the demands of the woke, you are not
immune.  Reported widely earlier this month, seen here most recently:


https://thejewishvoice.com/2020/08/brooklyn-college-education-prof-claims-math-is-white-supremacist-patriarchy/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 2:00 PM, Karen Shaeffer wrote:
> Where you conclude with: "Methinks there is an ideological skunk in the 
> parlor …”
> 
> Considering all your posts on this thread, it is reasonable to infer you have 
> some ideological motivations.

My motivation was to demonstrate that if people of your ilk are free to
peddle their worldview, it invites people of my worldview to join the party
and thereby wreak havoc.  The only way to solve this is: No politics, no 
culture,
no religion, or no sex. Period.  Ever.

Do take note that while I freely admit to having utter contempt for the
en courant culture and its various warriors, I also have been careful
to avoid flogging *my own* political/social view.  They don't belong
here.  Neither do yours.  Why don't we stick to discussing Python which
ought to not be infected by these subjects.


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


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 1:10 PM, J. Pic wrote:
> Tim, don't you also think that statements should be backed by
> evidence, even more if they are particularly accusatory ?
> 
> We'll be lucky if S&W's editor doesn't sue the PSF for slandering for
> publishing that S&W "upholds white supremacy".
> 

As a general matter, I agree: Claims should be supported by evidence.
But that's not the problem here.  The various cause crusaders are
attempting to insert themselves into every single discipline.  They
do this claiming their attacks as some kind of moral virtue and that
they are therefore above reproach or counterpoint.  It is natural
for people who disagree to punch back.

My real point in commenting at all was that we open this one-sided door
at our own peril. By allowing provocative commentary of the sort voice
in this godforsaken commit message, we absolutely invite others to the party.
Despite what the aforementioned cause crusaders think, they are not
unassailable, nor are they the only- or dominant voice in these matters.
Open this door and you get an absolute sewer of commentary
(from many sides of these issues).  Social media is full of many trenchant
such examples.  Best to leave it there.


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


Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 3:29 PM, Ethan Furman wrote:
> On 8/19/20 12:40 PM, Tim Daneliuk wrote:
>> On 8/19/20 2:00 PM, Karen Shaeffer wrote:
> 
>>> Considering all your posts on this thread, it is reasonable to infer you 
>>> have some ideological motivations.
>>
>> My motivation was to demonstrate that if people of your ilk are free to
>> peddle their worldview,
> 
> Unless you know Karen personally, you don't know what her world view is.  
> Poking holes in arguments or observing what is being said does not require an 
> opposing world view.

I'd say this is at least a hint:

>>> this peer reviewed published research from Stanford University establishes 
>>> the fact that racism and bias are alive and well in the STEM fields:

I have rather lengthy counterpoint to this "research".  Ditto the claim that 
proper
ordinarily use of English is prima facie evidence of "White Supremacy".  Ditto
the claim that any reference to age is inherently bigoted and cannot be taken
in good spirit.  But ... I don't think this is the place you'd like to see
my disquisitions on the matter.*

My larger point holds:  You cannot allow one worldview in and then expect
other worldviews to keeps still  ... and that's true irrespective of WHICH
worldview first got in the door.


> As you yourself said:
> 
>> The sole relevant
>> demand should be civility.
> 
> Let's make sure we stay that course.


I have never been anything other than this in the entire thread.  It is not 
uncivil
to disagree.

> 
> -- 
> ~Ethan~
> Python List Moderator

* Is the use of the word "disquisition" a form of White Supermacy?  Asking for 
a friend.

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


Re: Python's carbon guilt

2020-10-10 Thread Tim Daneliuk
On 10/10/20 2:35 PM, Marco Sulla wrote:
> He should also calculate the carbon dioxide emitted by brains that
> works in C++ only. I omit other sources.
> 


yes, methane is an alleged greenhouse gas as well
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: 1 Million users.. I can't Scale!!

2005-09-28 Thread Tim Daneliuk
yoda wrote:

> Hi guys,
> My situation is as follows:
> 
> 1)I've developed a service that generates content for a mobile service.
> 2)The content is sent through an SMS gateway (currently we only send
> text messages).
> 3)I've got a million users (and climbing).
> 4)The users need to get the data a minimum of 5 seconds after it's
> generated. (not considering any bottlenecks external to my code).
> 5)Generating the content takes 1 second.
> 

We need more information on just where the bottleneck might be.
There are any number of places that things could be getting
choked up and you need to get a profile of where things are
falling down before trying to fix it.

However, that said:

A possible culprit is session setup/teardown - I'm assuming connection
to the SMS gateway is connection-oriented/reliable, not datagram-based.
I suggest this because this is quite often the culprit in connection-
oriented performance problems.

If this is the case, you need to preestablish sessions and pool them for
reuse somehow so that each and every message transmission does not incur
the overhead of message setup and teardown to the gateway. It is a good
idea to make that session pooling logic adaptive. Have it start with a
minimum number of preestablished sessions to the gateway and then
monitor the message 'highwater' mark. As the system becomes starved for
sessions, alocate more to the pool. As system utililization declines,
remove spare sessions from the pool until the count falls back to the
initial minimum

Write the pooling manager to be able to configure both the initial
session count as well as the interval for adjusting that count up and
down (i.e. Over what interval you will 'integrate' the function that
figures out just how many sessions the pool needs). Too short an interval
and the system will throw itself into feedback hystersis trying to
figure out just many sessions you need. Too long an interval, and the
system will exhbit poor response to changing load.

P.S. My firm does consultancy for these kinds of problems. We're always
  looking for a great new customer.

Always-Developing-New-Business-ly Yours,

----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
-- 
http://mail.python.org/mailman/listinfo/python-list


OT - Re: Microsoft Hatred FAQ

2005-11-03 Thread Tim Daneliuk
David Blomstrom wrote:

> "Everytime someone compares MS's behavior with some
> less controversial criminal behavior, you act like
> they
> accused MS of holding people up at gunpoint."
> 
> Screwing literally millions of consumers and taxpayers
> and holding entire schools hostage is far worse than
> holding up an individual at gunpoint. The name
> Microsoft is virtually synonymous with crime, even if
> many people are too stupid to recognize it as crime -
> or the courts are too corrupt or inefficient to
> convict Bill Gates for many of his crimes.

A) I don't much care if people wander off topic from time to time -
that's what filters are for.  But as a matter of general courtesy
is it too much to ask that the subject line be so marked?

B) Rhetoric is not Reality.  "Crime" has a very specific definition.
It always has one or more of Fraud, Force, or Threat.  No such
case against Microsoft has ever been levied.  Just because *you*
don't like market outcomes doesn't make it a "crime".
Here is some *thoughtful* counterpoint (instead of the ignorant
foaming that has characterized this thread):

http://www.cato.org//pubs/pas/pa352.pdf
http://reason.com/0111/fe.dk.antitrusts.shtml
http://www.cato.org//pubs/pas/pa-405es.html

C) Hate Microsoft all you want.  But those of us old enough to have
actually done this for than 10 minutes recall the days where every single
hardware vendor was also a unique software and systems vendor.
Absent a Microsoft/Intel-style de facto standard, you'd never have
seen the ascent of Linux or Open Source as it exists today.  Drivers
are painful to write, so oddball or vendor-specific systems don't
get them very rapidly.  Microsoft/Intel commoditized the space whether
you like it or not.  They (perhaps unintentionally) created the
computer equivalent of "standard connectors" as found in audio systems.

D) Your ranting is puerile.  If you are going to waste bandwidth on
 OT matters, at least make it intelligent and/or interesting.

E) I prefer Unix and its variants.  However, I (and you) are direct
beneficiaries of Microsoft's success.

F) There are *more* choices than ever today for both systems and applications
software.  Stop foaming, and go do something useful with them ...



No Cheers,
-- 

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT - Re: Microsoft Hatred FAQ

2005-11-03 Thread Tim Daneliuk
Steven D'Aprano wrote:

> On Thu, 03 Nov 2005 04:34:20 -0500, Tim Daneliuk wrote:
> 
> 
> 
>>A) I don't much care if people wander off topic from time to time -
>>that's what filters are for.  But as a matter of general courtesy
>>is it too much to ask that the subject line be so marked?
> 
> 
> Fair enough.
> 
> 
>>B) Rhetoric is not Reality.  "Crime" has a very specific definition.
>>It always has one or more of Fraud, Force, or Threat.
> 
> 
> Nonsense.
> 
> Jaywalking is a crime. So is littering. So is merely belonging to certain
> organisations, such as the German Nazi party or any number of allegedly
> terrorist groups. Walking around naked in public is a crime, and in many
> places in the world, including the USA, you then become a "registered sex
> offender" for the rest of your life. (So much for doing time and wiping
> the slate clean.)
> 
> Possession of many substances is a crime in the USA, and not just drugs
> of addiction. There is no Fraud, Force or Threat involved in growing
> cannabis in your backyard, or selling pornography to teenagers, or driving
> without a licence.
> 
> Possession of banned books is a crime in many countries, and yes even in
> the 21st century there are many, many banned books. If legislation being
> urged on the US Senate by the MPAA is passed, manufacturing, selling and
> possibly even possession of analog to digital devices will become a crime
> -- not just a civil offense, or a misdemeanor, but a felony.


There is a difference between what is *illegal* and what constitutes
a *crime*.  There are many things that are illegal that ought not to
be (you mention several) becauase they do *not* meet the standard of
Fraud/Force/Threat.  These are laws that are inflicted by the majority
upon the minority because most people are nosey and want to tell
everyone else what to do.  Anti-trust laws also fit in this category.



> 
>>Just because *you*
>>don't like market outcomes doesn't make it a "crime".
> 
> 
> In civilizations that believe in freedom for human beings, freedom is not
> unlimited. There are actions which remain forbidden, even though that
> limits individual freedom. Bill Gates is not permitted to lock you up
> against your will: his freedom to restrict others' freedoms is severely
> curtailed.
> 
> In civilizations that believe in free markets, freedom is also not
> unlimited. There are actions which are forbidden, because those actions

That's right - you cannot use fraud/force/threat.  The rest is nobody's
business.But your claim that government mut place restrictions
on free markets is bogus.  It likely springs from a polluted understanding
of just what the role of government ought to be and how markets actually
work.

> 
> 
>>C) Hate Microsoft all you want.  But those of us old enough to have
>>actually done this for than 10 minutes recall the days where every single
>>hardware vendor was also a unique software and systems vendor.
>>Absent a Microsoft/Intel-style de facto standard, you'd never have
>>seen the ascent of Linux or Open Source as it exists today.
> 
> 
> Nonsense again.
> 
> Real standards, like TCP/IP which is the backbone of the Internet, aren't

TCP/IP was NOT an open standard originally.  It came into being at the
hands of a monopoly (government) and at the point of a gun (forced taxation).


> controlled by any one company. Anyone can create a TCP stack. Nobody but
> Microsoft can create a competing version of Windows. TCP/IP became a

So what?  This does not make Microsoft a monopolist.  It makes it a sole
source vendor.  What gives Microsoft their market power is
*their customers* who feel they are getting a good deal.   No one forces
their customers to buy the products, and there are real alternatives
available.  Just why, do you suppose, people continue to use Windows
is large numbers when Linux/BSD is *free*?   Because they hate
Windows?  Because Microsoft is overcharging or cheating them?  Get
a grip.  Microsoft succeeds because it serves its customer base.
They do it on a scale that makes everyone else jealous and instead of
outcompeting Microsoft, they go whining to the DOJ about how unfair
the world is.

> standard long before Microsoft even acknowledged it's existence. So did
> ASCII, the IBM BIOS, and serial ports, to name just a few. Does the term
> "ISO standard" mean anything to you?

I have been a member of many standards committees including POSIX,
ANSI, and X/OPEN.  Standards committees do not *set* standards, they
codify existing common practice - well the successful standards do.
That's why POSIX 1003.1 is an embraced standard and X/Open is a footnote
in t

Re: OT - Re: Microsoft Hatred FAQ

2005-11-03 Thread Tim Daneliuk
Steven D'Aprano wrote:

> On Thu, 03 Nov 2005 14:56:44 -0500, Tim Daneliuk wrote:
> 
> 
>>There is a difference between what is *illegal* and what constitutes
>>a *crime*.
> 
> 
> Why thank you, you've really made my day. That's the funniest thing I've
> heard in months. Please, do tell, which brand of corn flakes was it that
> you got your law degree from?
> 
> 



"Crime" is at least partly a moral precept. More properly, "crime" is a
term that broadly embraces the idea of "harm" especially to others.

"Illegal" is a exclusively a legal precept. It is a "crime" to murder
someone, but if the state cannot prove your guilt you are found to have
done nothing "illegal", for example.

We would hope that the latter proceeds from the former, but it does not
always. You would be doing something that is illegal if you smoked
marijuana, but by no rational definition would have actually committed
moral foul or "crime" (except, possibly, upon yourself).

I realize these two words are conflated in common use and am thus
sympathetic to your confusion. This is my fault. What I actually should
have written in the first place was:


There is a difference between what is *wrong* (and thus ought to
be illegal) and what actually constitutes a formally illegal act
as a matter of law.  We'd like the two to be isomorphic but they
are not due to self-important busybodies telling everyone else what
to do.

Clearer now?



-- 

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter Puzzler

2005-01-07 Thread Tim Daneliuk
I am trying to initialize a menu in the following manner:
for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", KeyHomeDir), ("Startdir", KeyStartDir), ("Root", 
KeyRootDir)]:

func = entry[1]
UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: func(None))
However, at runtime, each of the menu options binds to the *last* function
named in the list (KeyStartDir).
Explicitly loading each entry on its own line works fine:
UIcommand=lambda:KeyWHATEVERDir(None)
Any ideas why the first form does not fly?
TIA,
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Puzzler

2005-01-07 Thread Tim Daneliuk
Tim Daneliuk wrote:
I am trying to initialize a menu in the following manner:
for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", 
KeyHomeDir), ("Startdir", KeyStartDir), ("Root", KeyRootDir)]:

func = entry[1]
UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: 
func(None))

However, at runtime, each of the menu options binds to the *last* function
named in the list (KeyStartDir).
Explicitly loading each entry on its own line works fine:
UIcommand=lambda:KeyWHATEVERDir(None)
Any ideas why the first form does not fly?
TIA,
-------- 

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
Thanks All - great responses!
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Tkinter, Alt, and Windows

2005-01-07 Thread Tim Daneliuk
Arggg.  I have a program that runs comfortably across both Unix variants
and Windows ... except  I wish to bind an Alt-ButtonRelease-3 combination
to popup a menu.  This works flawlessly under Unix, but with windows,
the menu appears briefly and then disappears.  I'm guessing that Alt
under windows generates another event that I am not catching and the
default internal Tk message handler is processing it and causing my
menu to get destroyed.
It seems that any combination involving the Alt key has this issue -
for example Control-Alt-ButtonRelease-3 does the same thing.
Has anyone else run into this behavior and have a fix???
TIA,
----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter, Alt, and Windows

2005-01-07 Thread Tim Daneliuk
Tim Daneliuk wrote:
Arggg.  I have a program that runs comfortably across both Unix 
variants
and Windows ... except  I wish to bind an Alt-ButtonRelease-3 
combination
to popup a menu.  This works flawlessly under Unix, but with windows,
the menu appears briefly and then disappears.  I'm guessing that Alt
under windows generates another event that I am not catching and the
default internal Tk message handler is processing it and causing my
menu to get destroyed.

It seems that any combination involving the Alt key has this issue -
for example Control-Alt-ButtonRelease-3 does the same thing.
Has anyone else run into this behavior and have a fix???
I have a partial workaround but the mechanics still mystify me.
I actually was trying to bind two different popup menus to as follows:
Alt-ButtonRelease-3   Menu1
Alt-Control-ButtonRelease-3   Menu2
This did not work ... so I began to wonder if this was problem
with Tk using greedy matching with event descriptors.  So, I changed
it as follows:
Control-ButtonRelease-3   Menu1
Alt-Control-ButtonRelease-3   Menu2
This now works fine, BUT ONLY if Alt is pressed *before* Control when popping up
Menu2.  IOW Windows is sensitive to the *order* of Alt being applied where
Unix is not.  Very, very strange ...

--
----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Getting List Of All Filesystem Mounts

2005-01-08 Thread Tim Daneliuk
Is there some pure Python/portable way to get a list
of all currently mounted filesystems?

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python.org, Website of Satan

2005-01-11 Thread Tim Daneliuk
DogWalker wrote:
"Luis M. Gonzalez" <[EMAIL PROTECTED]> said:

[EMAIL PROTECTED] wrote:
python.org = 194.109.137.226
194 + 109 + 137 + 226 = 666
What is this website with such a demonic name and IP address?  What
evils are the programmers who use this language up to?
You dared to unveil our secret.
Now we'll have to kill you...
But is 194.109.137.226 the only one? What other sites are in league
with the python?
Yes, it's troublesome, perhaps more than you realize. Consider:
10.255.255.146
Yikes!  Potential demonic (daemonic?) worship could be practiced non-routably...
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


[ANN]: twander 3.160 Released And Available

2005-01-12 Thread Tim Daneliuk
'twander' Version 3.160 is now released and available for download at:
 http://www.tundraware.com/Software/twander
The last public release was 3.146.
Existing users are encouraged to upgrade to this release as it has
a number of bug fixes and several nice new features including:
  - Mouse popups for all the menus (except Help).
  - Ability to force Unix-style paths under Windows when doing substitutions in
  command macros. (Very helpful for cygwin users.)
  - A smarter "adaptive" directory refresh mechanism.
  - A new "Shortcut" menu for fast navigation around the filesystem.
Complete details of all fixes, changes, and new features can be found in
the WHATSNEW.txt file included in the distribution.
Users are strongly encouraged to join the twander-users mailing list as
described in the documentation.

What Is 'twander'?
--
'twander' is a macro-programmable Filesystem Browser that runs on both
Unix-like systems as well as Win32 systems. It embraces the best ideas
of both similar GUI-driven programs (Konqueror, Windows Explorer) as
well as text-based interfaces (Midnight Commander, List, Sweep).
Or, If You Prefer The "Elevator Pitch"
--
'twander' is:
   - A better file browser for Unix and Win32. (Tested on FreeBSD, Linux, 
Win32.)
   - A way to make browsing the same on all the OSs you use.
   - A macro-programmable tool that lets *you* define the features.
   - A GUI navigation front-end for your shell.
   - A way to "can" workflows for your technically-challenged colleagues.
   - A way to free yourself from the shackles of the mouse.
   - A way to significantly speed up your day-to-day workflow.
   - A Python/Tkinter application - about 3100/1300 lines of code/comments
   - A RCT (Really Cool Tool) that will have you addicted in a day or two
See the web page for more information, a screen shot, and the complete
documentation.
------
Tim Daneliuk
[EMAIL PROTECTED]





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


[ANN]: twander 3.160 Released And Available

2005-01-12 Thread Tim Daneliuk
'twander' Version 3.160 is now released and available for download at:
 http://www.tundraware.com/Software/twander
The last public release was 3.146.
Existing users are encouraged to upgrade to this release as it has
a number of bug fixes and several nice new features including:
  - Mouse popups for all the menus (except Help).
  - Ability to force Unix-style paths under Windows when doing substitutions in
  command macros. (Very helpful for cygwin users.)
  - A smarter "adaptive" directory refresh mechanism.
  - A new "Shortcut" menu for fast navigation around the filesystem.
Complete details of all fixes, changes, and new features can be found in
the WHATSNEW.txt file included in the distribution.
Users are strongly encouraged to join the twander-users mailing list as
described in the documentation.

What Is 'twander'?
--
'twander' is a macro-programmable Filesystem Browser that runs on both
Unix-like systems as well as Win32 systems. It embraces the best ideas
of both similar GUI-driven programs (Konqueror, Windows Explorer) as
well as text-based interfaces (Midnight Commander, List, Sweep).
Or, If You Prefer The "Elevator Pitch"
--
'twander' is:
   - A better file browser for Unix and Win32. (Tested on FreeBSD, Linux, 
Win32.)
   - A way to make browsing the same on all the OSs you use.
   - A macro-programmable tool that lets *you* define the features.
   - A GUI navigation front-end for your shell.
   - A way to "can" workflows for your technically-challenged colleagues.
   - A way to free yourself from the shackles of the mouse.
   - A way to significantly speed up your day-to-day workflow.
   - A Python/Tkinter application - about 3100/1300 lines of code/comments
   - A RCT (Really Cool Tool) that will have you addicted in a day or two
See the web page for more information, a screen shot, and the complete
documentation.
------
Tim Daneliuk
[EMAIL PROTECTED]





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


Unclear On Class Variables

2005-01-13 Thread Tim Daneliuk
I am a bit confused.  I was under the impression that:
class foo(object):
x = 0
y = 1
means that x and y are variables shared by all instances of a class.
But when I run this against two instances of foo, and set the values
of x and y, they are indeed unique to the *instance* rather than the
class.
It is late and I am probably missing the obvious.  Enlightenment appreciated ...
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: news feed problem -- anyone else?

2005-01-17 Thread Tim Daneliuk
Bengt Richter wrote:
I can see postings on google, but my news service
is having a problem since sometime during the weekend.
Can get old stuff from other n.g., but no new.
Wondering whether I'll see this via google.
Regards,
Bengt Richter
Bengt -
I've had very good luck using the following *free* newsfeed:
http://individual.net/
HTH,
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


[ANN] tconfpy 2.112 Released And Available

2005-01-20 Thread Tim Daneliuk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
'tconfpy' Version 2.112 is now released and available for download at:
~ http://www.tundraware.com/Software/tconfpy
The last public release was 1.185 (5-2-2004)
This is a significant bugfix and feature upgrade release.  Existing
users are strongly encouraged to upgrade.  Be aware that the passed
and returned API parameters have changed, as have some of the
semantics of the configuration language, so existing code and/or
configuration files may need to be edited accordingly.
Complete details can be found in the WHATSNEW.txt file included in the
distribution.
Users are strongly encouraged to join the tconfpy-users mailing list as
described in the documentation.
What Is 'tconfpy'?
- --
'tconfpy' is an advanced configuration file parser and validator for
Python programs.  By using 'tconfpy', Python programmers can provide
their users with an external configuration file for setting program
options, defining defaults, and so on.  'tconfpy' offloads the
responsibility for parsing and validating a configuration file from
the main application. The Python programmer need only deal
with the results and any errors or warnings generated during the
parsing process.
'tconfpy' recognizes a rich configuration language and provides a
number of sophisticated programming features including:
~- The ability to breakup large configurations into smaller pieces
~  via the '.include' directive.
~- Support for string substitution and concatenation throughout the
~  configuration file via string variables.  Variables may be
~  locally declared, a reference to a symbol already in the
~  symbol table, or a reference to an environment variable.
~- A complete set of conditional directives for selective
~  processing of configuration options. Both existential ("If
~  variable exists ...") and comparison ("if string equals/does not
~  equal string ...") forms are provided, as is an '.else'
~  directive.
~- The ability to instantiate program options prior to reading a
~  configuration file and make them mandatory by declaring those
~  options as Read-Only.
~- Optional type validation to ensure that a user enters a value
~  appropriate for boolean, integer, floating point, string, or
~  complex data.
~- Optional value validation to ensure that a configuration option
~  is either within a specified range or one of an enumerated set
~  of possible values.  For configuration options which are string
~  types, 'tconfpy', can optionally specify min/max string lengths
~  and enumerate a set of legitimate regular expressions that the
~  string must match.
~- The ability to define an arbitrary number of lexical namespaces.
~- The ability to use the various features of 'tconfpy' as a pre-
~  processor for any other text (including source code for other
~  programming languages and Python itself) via the '.literal'
~  directive.
~- The ability to "template" classes of variables, thereby predefining
~  the type and value restrictions for such variables.  This makes
~  'tconfpy' useful as a building block for data validation tools.
~- An optional debug capability which returns detailed information
~  about each line parsed.
~- Includes a test driver program for learning how to program with
~  'tconfpy' and for debugging and testing your own configuration
~  files.
~- Comes with approximately 40 pages of documentation including a
~  Programmer's API Reference and a User's Guide to the 'tconfpy'
~  configuration language.  Documentation is provided in several
~  formats including Unix 'man', Plain Text, html, pdf, and
~  Postscript.
'tconfpy' is a Pure Python module and is platform-independent.
It should work identically on any platform on which Python runs.
- --
Tim Daneliuk
[EMAIL PROTECTED]






-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFB744ayjgA+Mact+YRAopHAJ952scQ/LVBz5ye+VARvuhsKk+9cgCfYNSQ
LLuefsso1mXxdh38EEovuCo=
=ojco
-END PGP SIGNATURE-
--
http://mail.python.org/mailman/listinfo/python-list


re Insanity

2005-01-22 Thread Tim Daneliuk
For some reason, I am having the hardest time doing something that should
be obvious.  (Note time of posting ;)
Given an arbitrary string, I want to find each individual instance of
text in the form:  "[PROMPT:optional text]"
I tried this:
y=re.compile(r'\[PROMPT:.*\]')
Which works fine when the text is exactly "[PROMPT:whatever]" but
does not match on:
   "something [PROMPT:foo] something [PROMPT:bar] something ..."
The overall goal is to identify the beginning and end of each [PROMPT...]
string in the line.
Ideas anyone?
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Comments in configuration files

2005-01-22 Thread Tim Daneliuk
Pierre Quentel wrote:
Bonjour,
I am developing an application and I have a configuration file with a 
lot of comments to help the application users understand what the 
options mean

I would like it to be editable, through a web browser or a GUI 
application. With ConfigParser I can read the configuration file and 
edit the options, but when I write the result all the comments are lost

Are there modules that work on the same kind of ini files (for the needs 
of my application, I prefer this format to XML or YAML) and don't remove 
the comments ?

TIA,
Pierre

The latest incarnation of 'tconfpy' I just released will get you close:
 http://www.tundraware.com/Software/tconfpy
This program can read a configuration either from memory (a list) or a file.
So you could:
1) Read the file into an in-memory list (including the comments).
2) Pass the list to the parser, which would return a populated symbol
   table.
3) Use your application to read the current values of the symbols from
   the symbol table.
4) Modify the values in the symbol table as desired.
5) Map the new values in the symbol table back into the original list where
   the values were set intitially (this is the part that would take some work).
6) Write the list back to disk.
Note that the semantics of feature of 'tconfpy' are substantially different
than 'ConfigParser', and the languages recognized by each are quite different
as well.  It is probably fair to say that 'tconfpy' recognizes a superset
of the language recognized by 'ConfigParser'.  But you have to be
careful because the semantics are somewhat different.

--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote:
Tim Daneliuk wrote:

Given an arbitrary string, I want to find each individual instance of
text in the form:  "[PROMPT:optional text]"
I tried this:
   y=re.compile(r'\[PROMPT:.*\]')
Which works fine when the text is exactly "[PROMPT:whatever]"

didn't you leave something out here?  "compile" only compiles that pattern;
it doesn't match it against your string...
Sorry - I thought this was obvious - I was interested more in the conceptual
part of the contruction of the re itself.

but does not match on:
  "something [PROMPT:foo] something [PROMPT:bar] something ..."
The overall goal is to identify the beginning and end of each [PROMPT...]
string in the line.

if the pattern can occur anywhere in the string, you need to use "search",
not "match".  if you want multiple matches, you can use "findall" or, better
in this case, "finditer":
import re
s = "something [PROMPT:foo] something [PROMPT:bar] something"
for m in re.finditer(r'\[PROMPT:[^]]*\]', s):
print m.span(0)
prints
(10, 22)
(33, 45)
which looks reasonably correct.
(note the "[^x]*x" form, which is an efficient way to spell "non-greedy match"
for cases like this)
Thanks - very helpful.  One followup - your re works as advertised.  But
if I use: r'\[PROMPT:[^]].*\]'  it seems not to.  the '.*' instead of just '*'
it matches the entire string ... which seems counterintutive to me.
Thanks,
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: re Insanity

2005-01-23 Thread Tim Daneliuk
Orlando Vazquez wrote:
Tim Daneliuk wrote:
For some reason, I am having the hardest time doing something that should
be obvious.  (Note time of posting ;)
Given an arbitrary string, I want to find each individual instance of
text in the form:  "[PROMPT:optional text]"
I tried this:
y=re.compile(r'\[PROMPT:.*\]')
Which works fine when the text is exactly "[PROMPT:whatever]" but
does not match on:
   "something [PROMPT:foo] something [PROMPT:bar] something ..."
The overall goal is to identify the beginning and end of each [PROMPT...]
string in the line.
Ideas anyone?

If I understand correctly, this is what you are trying to achieve:
 >>> import re
 >>> temp = "something [PROMPT:foo] something [PROMPT:bar] something ..."
 >>> prompt_re = re.compile(r"\[PROMPT:.*?\]")
 >>> prompt_re.findall(temp)
['[PROMPT:foo]', '[PROMPT:bar]']
 >>>
HTH,
--
Orlando
Yes - that seems to be the simplest solution to the problem.  I'd forgotten
entirely about non-greedy matching when I asked the question.  Thanks.
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote:
Tim Daneliuk wrote:

Thanks - very helpful.  One followup - your re works as advertised.  But
if I use: r'\[PROMPT:[^]].*\]'  it seems not to.  the '.*' instead of just '*'
it matches the entire string ...

it's not "just '*'", it's "[^]]*".  it's the "^]" set (anything but ]) that's 
repeated.
"[^]].*\]" means match a single non-] character, and then match as many
characters as you possibly can, as long as the next character is a ].
"[^]]*\]" means match as many non-] characters as possible, plus a single ].
Got it - 'Makes perfect sense too

which seems counterintutive to me.

then you need to study RE:s a bit more.
(hint: an RE isn't a template, it's a language description, and the RE engine
is designed to answer the question "does this string belong to this language"
(for match) or "is there any substring in this string that belongs to this
language" (for search) as quickly as possible.  things like match locations
etc are side effects).
Yes, I understand this.  But your clarification is most helpful.  Thanks!

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: re Insanity

2005-01-26 Thread Tim Daneliuk
Aahz wrote:
In article <[EMAIL PROTECTED]>,
Tim Daneliuk  <[EMAIL PROTECTED]> wrote:
Given an arbitrary string, I want to find each individual instance of
text in the form:  "[PROMPT:optional text]"
I tried this:
   y=re.compile(r'\[PROMPT:.*\]')
Which works fine when the text is exactly "[PROMPT:whatever]" but
does not match on:
  "something [PROMPT:foo] something [PROMPT:bar] something ..."
The overall goal is to identify the beginning and end of each [PROMPT...]
string in the line.
Ideas anyone?

Yeah, read the Friedl book.  (Okay, so that's not gonna help right now,
but trust me, if you're going to write lots of regexes, READ THAT BOOK.)
I've read significant parts of it.  The problem is that I don't write
re often enough to recall all the subtle details ... plus I am getting
old and feeble... ;)
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-27 Thread Tim Daneliuk
I am currently underling the first character of a menu title (to indicate
its shortcut/accelerator key) like this:
   self.WildBtn = Menubutton(self.mBar, text=WILDMENU, underline=0, 
state=DISABLED)
However, I intend to actually have two separate keys invoke this menu
to have it behave differently in different circumstances.
Is it possible to underline more than a single character as I am doing
with the 'underline=0' above. I tried 'underline=(0,2)' but that didn't
work.
Ideas?
TIA,
--
----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-27 Thread Tim Daneliuk
Jeff Epler wrote:
On Thu, Jan 27, 2005 at 06:38:22AM -0500, Tim Daneliuk wrote:
Is it possible to underline more than a single character as I am doing
with the 'underline=0' above. I tried 'underline=(0,2)' but that didn't
work.

No.
Jeff
I love a clear answer ;) thanks...
--
----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-31 Thread Tim Daneliuk
Tim Roberts wrote:
Tim Daneliuk <[EMAIL PROTECTED]> wrote:
I am currently underling the first character of a menu title (to indicate
its shortcut/accelerator key) like this:
  self.WildBtn = Menubutton(self.mBar, text=WILDMENU, underline=0, 
state=DISABLED)
However, I intend to actually have two separate keys invoke this menu
to have it behave differently in different circumstances.

You can, of course, CHANGE the underlined character to match the
circumstances.
Yeah, I understand that ... what I want is two characters simulatenously
underlined ... oh well, another solution will be arranged...
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-02-01 Thread Tim Daneliuk
Fredrik Lundh wrote:
Tim Daneliuk wrote:

However, I intend to actually have two separate keys invoke this menu
to have it behave differently in different circumstances.
You can, of course, CHANGE the underlined character to match the
circumstances.
Yeah, I understand that ... what I want is two characters simulatenously
underlined ... oh well, another solution will be arranged...

if you want a menu choice to have different behaviour depending on what
key you use to invoke them, you should use two different choices.
 


That is my intention.  I have a menu that lists a set of regular expressions
available for a particular task.  However, the regex are applied in two
different ways for this task.  I want a common menu for displaying all
the choices, but two separate "Accelerator Keys" to invoke it, depending
on the desired application...
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Nokia Chooses Python

2005-02-01 Thread Tim Daneliuk
http://press.nokia.com/PR/200501/978226_5.html
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Generating .pyc/.pyo from a make file

2005-02-02 Thread Tim Daneliuk
I use a makefile to create distribution tarballs of freestanding Python
programs and their documentation.  I cannot seem to find the right
command line option to just generate a pyc/pyo file from the program
and then exit.  If I use 'python - -c"import myprog"' it creates
the pyo file, but myprog starts up and keeps running.
IOW, I need a batch method for generating compiled python.  I know it
exists, but I can't find it for some reason ...
TIA,
--
----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Tim Daneliuk
Roland Heiber wrote:
Tim Daneliuk wrote:
I use a makefile to create distribution tarballs of freestanding Python
programs and their documentation.  I cannot seem to find the right
command line option to just generate a pyc/pyo file from the program
and then exit.  If I use 'python - -c"import myprog"' it creates
the pyo file, but myprog starts up and keeps running.
IOW, I need a batch method for generating compiled python.  I know it
exists, but I can't find it for some reason ...
TIA,
Hi,
take a look at http://docs.python.org/lib/module-compileall.html
HtH, Roland
It does - thanks.  One more question:  Are pyc and pyo file portable
across operating systems?  I suspect not since I generated a pyo
on a FreeBSD machine that will not run on a Win32 machine.  I was
under the impression that "compiled" meant optimized byte code that
was portable across implementations, but it looks to not be the case...
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Generating .pyc/.pyo from a make file

2005-02-02 Thread Tim Daneliuk
Steve Holden wrote:
Roland Heiber wrote:
Tim Daneliuk wrote:
It does - thanks.  One more question:  Are pyc and pyo file portable
across operating systems?  I suspect not since I generated a pyo
on a FreeBSD machine that will not run on a Win32 machine.  I was
under the impression that "compiled" meant optimized byte code that
was portable across implementations, but it looks to not be the case...
Hi,
..pyc's should be, cause it's standard python-bytecode, if you use 
massive optimizations it depends not on the os but on the underlying 
cpu/architecture ...

So long, Roland

You probably tried to use a bytecode file from *one* version of Python 
with an interpreter of another version. Python actually checks the first 
four bytes of the .pyc file for a compatible "magic number" before 
accepting the file for execution.

regards
 Steve
Aha!  Exactly ... and that makes perfect sense too.  D'oh!  I guess a better
distribution strategy would be to have the installation program generate the pyo
file at installation time...
Thanks -
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-03 Thread Tim Daneliuk
Paul Rubin wrote:

I've only worked on one serious site of this type and it was "SAJO"
(Solaris Apache Java Oracle) rather than LAMP, but the concepts are
the same.  I just feel like something bogus has to be going on.  I
think even sites like Slashdot handle fewer TPS than a 1960's airline
reservation that ran on hardware with a fraction of the power of one
of today's laptops.
I worked for an Airline computer reservation system (CRS) for almost a
decade. There is nothing about today's laptops that remotely comes close
to the power of those CRS systems, even the old ones. CRS systems are
optimized for extremely high performance I/O and use an operating system
(TPF) specifically designed for high-performance transaction processing.
Web servers are very sessions oriented: make a connection-pass the unit
of work-drop the connection. This is inherently slow (and not how high
performance TP is done). Moreover, really high perfomance requires a
very fine level of I/O tuning on the server - at the CRS I worked for,
they performance people actually only populated part of the hard drives
to minimize head seeks.
The point is that *everything* has to be tuned for high performance
TP - the OS, the language constructs (we used assembler for most things),
the protocols, and the overall architecture.  THis is why, IMHO,
things like SOAP a laughable - RPC is a poor foundation for reliable,
durable, and high-performance TP.  It might be fine for sending an
order or invoice now and then, but sustained throughput of the sort
I think of as "high" performance is likely never going to be accomplished
with session-oriented architectures.
For a good overview of TP design, see Jim Gray's book, "Transaction Processing:
Concepts and Techniques".
P.S. AFAIK the first CRS systems of any note came into being in the 1970s not
 the 1960s, but I may be incorrect in the matter.
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-03 Thread Tim Daneliuk
Paul Rubin wrote:
Simon Wittber <[EMAIL PROTECTED]> writes:
Slow is such an ambiguous term. Do you mean the pages are slow to
render in a browser, or slow to be fetched from the server, or the
server is slow to respond to requests? What is slow?

The server is slow to respond to requests.  Browser rendering is
independent of the server architecture and "slow to be fetched from
the server" sounds like it means low network speed.  I'm talking about
the very familiar experience of clicking a link and then waiting,
waiting, waiting for the page to load.  You rarely see that happen
with Ebay or Google.  It happens all the time with Wikipedia.
This has a lot to do with the latency and speed of the connecting
network. Sites like Ebay, Google, and Amazon are connected
to internet backbone nodes (for speed) and are cached throughout
the network using things like Akami (to reduce latency)...
--
----
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-03 Thread Tim Daneliuk
Paul Rubin wrote:
Tim Daneliuk <[EMAIL PROTECTED]> writes:
I worked for an Airline computer reservation system (CRS) for almost a
decade. There is nothing about today's laptops that remotely comes close
to the power of those CRS systems, even the old ones. CRS systems are
optimized for extremely high performance I/O and use an operating system
(TPF) specifically designed for high-performance transaction processing.

Yeah, I've been interested for a while in learning a little bit about
how TPF worked.  Does Gray's book that you mention say much about it?
I honestly do not recall.  TPF/PAARS is an odd critter unto itself
that may not be covered by much of anything other than IBM docs.
I think that the raw hardware of today's laptops dwarfs the old big
iron.  An S/360 channel controller may have basically been a mainframe
in its own right, but even a mainframe in those days was just a few
MIPS.  The i/o systems and memory are lots faster too, though not by
nearly the ratio by which storage capacity and cpu speed have
increased.  E.g., a laptop disk these days has around 10 msec latency
and 20 MB/sec native transfer speed, vs 50+ msec and a few MB/sec for
a 3330-level drive (does that sound about right?.  
Again, I don't know.  The stuff we had was much newer (and faster) than
that.

Web servers are very sessions oriented: make a connection-pass the
unit of work-drop the connection. This is inherently slow (and not
how high performance TP is done). Moreover, really high perfomance
requires a very fine level of I/O tuning on the server - at the CRS
I worked for, they performance people actually only populated part
of the hard drives to minimize head seeks.

Today I think most seeks can be eliminated by just using ram or SSD
(solid state disks) instead of rotating disks.  But yeah, you wouldn't
do that on a laptop.
But that still does not solve the latency problem of session establishment/
teardown over network fabric which is the Achilles Heel of
the web and web services.

For a good overview of TP design, see Jim Gray's book, "Transaction
Processing: Concepts and Techniques".

Thanks, I'll look for this book.  Gray of course is one of the
all-time database gurus and that book is probably something every
serious nerd should read.  I've probably been a bad boy just for
having not gotten around to it years ago.

P.S. AFAIK the first CRS systems of any note came into being in the 1970s not
 the 1960s, but I may be incorrect in the matter.

From <http://en.wikipedia.org/wiki/Sabre_%28computer_system%29>:
The system [SABRE] was created by American Airlines and IBM in the
1950s, after AA president C. R. Smith sat next to an IBM sales
representative on a transcontinental flight in 1953. Sabre's first
mainframe in Briarcliff Manor, New York went online in 1960. By
1964, Sabre was the largest private data processing system in the
world. Its mainframe was moved to an underground location in
Tulsa, Oklahoma in 1972.
Originally used only by American, the system was expanded to travel
agents in 1976. It is currently used by a number of companies,
including Eurostar, SNCF, and US Airways. The Travelocity website is
owned by Sabre and serves as a consumer interface to the system.
I stand (sit) corrected ;)
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-04 Thread Tim Daneliuk
Paul Rubin wrote:
Tim Daneliuk <[EMAIL PROTECTED]> writes:
[other good stuff from Tim snipped]
Today I think most seeks can be eliminated by just using ram or SSD
(solid state disks) instead of rotating disks.  But yeah, you wouldn't
do that on a laptop.
But that still does not solve the latency problem of session
establishment/ teardown over network fabric which is the Achilles
Heel of the web and web services.

Well, HTTP 1.1 keepalives takes care of some of that, but really,
really, most of this problem is server side, like when you browse a
Wikipedia page it might take a few seconds, which isn't good, but when
you update it, it takes most of a minute, which is awful.  The
difference is that editing means server side web cache misses followed
by a database update that affects numerous indices.
Noted and agreed.  However, also note that establishing/killing
sessions over a high-latency architecture is generally problematic.
The latency can come from any number of sources including servers
starving for memory/cache misses, as well as the network itself exhbiting
latency problems.  One of reasons the older CRS systems were so fast
was that, although the connection *speeds* were low, the networks were
private, polled fabric with very predictable performance characteristics.
Every terminal was guaranteed to be serviced at a regular interval.
Better customers (who were guaranteed better service levels) just got
their terminals serviced more frequently.
When I left Apollo in the mid-
1990s, there were customers running on this private network who were
guaranteed 3 second or better *round-trip* time (from Enter to transaction
results displayed).  This was in an environment with nearly 100,000
users and the core system peaking at something like 22,000 TPC/As
per second ... with 2 or 3 minutes of scheduled downtime per year.
This kind of performance comes from looking at the architecture as a whole,
not just pieces and parts.  One of the troublesome things about the web
is that this kind of systemic thinking about performance and reliability
seems to be rather rare.  For instance, he whole design of SOAP/RPC seems to be
oblivious to the 40+ years of history on these issues that preceded
the web.
With the advent of public/dynamic networks where a lot of discovery and
variable load exists, it is much harder to nail up a latency and
throughput guarantee.  This is part of the motiviation for adding QOS
facilities to IPV6.  However, as a practical matter, I think the explosion
of last-mile broadband as well as generally more lit up fiber in the backbones
may make QOS less necessary - we'll just throw bigger pipes at the problem.
It is well within the realm of possibility that we'll see OC3 class bandwidth
to the premise for reasonable cost in the foreseeable future.
Wikipedia keeps having these fundraising drives to buy more server CPU
iron (I've donated a few times) but I wonder if they'd be better off
spending it on solid state disks and/or software reorganization.
Since I do not use Wikipedia, I have no meaningful comment.  As someone
pointed out here, PHP is also suspect when seeing performance issues.

One of the things I love about Python is its facility for allowing you to do
things that are time-insensitive in a VHLL and then dive into C or even 
assembler
if needed for the time-critical stuff.  This fixes the language part of the
architecture problem, but does not, in and of itself, amerliorate the larger
systems architeture questions (nor would I expect it to)...
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-04 Thread Tim Daneliuk
Fredrik Lundh wrote:
Tim Daneliuk wrote:

THis is why, IMHO, things like SOAP a laughable - RPC is a poor
foundation for reliable, durable, and high-performance TP.  It might be
fine for sending an order or invoice now and then, but sustained through-
put of the sort I think of as "high" performance is likely never going to be
accomplished with session-oriented architectures.

does 50 gigabytes per day, sustained, count as high performance in your book?
 


'Depends.  It is certainly a high-volume application.  But is it
transactional?  Is it online or batch?  Does it have correctness
guarantees and so forth ...   You can ftp 50 gigabytes in one
day with big enough network pipes, but that does not a transactional
system make, for example ...
--
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Looking For Geodetic Python Software

2005-06-22 Thread Tim Daneliuk
Is anyone aware of freely available Python modules that can do any of
the following tasks:

1) Given the latitude/longitude of two locations, compute the distance
between them.  "Distance" in this case would be either the straight-line
flying distance, or the actual over-ground distance that accounts for
the earth's curvature.

2) Given n latitude/longitude coordinates, compute the
"geocenter".  That is, return the lat/long of the location that
is most "central" to all n initial coordinates.

3)  Given n lat/long coordinates, compute a Kruskal-type spanning
 tree.

4) Given n lat/long coordinates, compute an optimal (shortest or longest)
visitation path that reaches each node exactly once.  Better still would
be something that had "pluggable" heuristic engines so we could try
different approaches like greedy, shortest-path, hill climbing, and
so forth.  It would be even nicer if one could also simulate different
routing schemes (Monte Carlo?).

In effect, I'm looking for something that mates traditional graph traversal
heuristics with operations research tools working on a geodetic
coordinate system.   This is *way* outside my field of expertise so
I'm hoping someone has taken the pain of it for dummies like me ;)

TIA,
-- 
--------
Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/

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


Re: Looking For Geodetic Python Software

2005-06-22 Thread Tim Daneliuk
Casey Hawthorne wrote:
> Tim Daneliuk <[EMAIL PROTECTED]> wrote:
> 
> 
>>Is anyone aware of freely available Python modules that can do any of
>>the following tasks:
>>
>>1) Given the latitude/longitude of two locations, compute the distance
>>   between them.  "Distance" in this case would be either the straight-line
>>   flying distance, or the actual over-ground distance that accounts for
>>   the earth's curvature.
> 
> 
> Do your planes fly over the earth's surface or through the ground?
> 
> 
> --
> Regards,
> Casey

Why do you presume this has anything to do with airplanes?

-- 

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >