Re: print header for output

2011-06-18 Thread Chris Rebert
On Sat, Jun 18, 2011 at 9:57 PM, Cathy James wrote: > I managed to get output for my function, thanks much  for your > direction. I really appreciate the hints. Now I have tried to place > the statement "print ("Length \t" + "Count\n")" in different places in > my code so that the function can pri

Re: Python and Lisp : car and cdr

2011-06-18 Thread Lie Ryan
On 06/18/11 00:45, Franck Ditter wrote: > Hi, I'm just wondering about the complexity of some Python operations > to mimic Lisp car and cdr in Python... > > def length(L) : > if not L : return 0 > return 1 + length(L[1:]) > > Should I think of the slice L[1:] as (cdr L) ? I mean, is the slic

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile toImprovethe Dvorak Layout?

2011-06-18 Thread Lie Ryan
On 06/19/11 15:14, rusi wrote: > On Jun 19, 9:21 am, Lie Ryan wrote: >> On 06/18/11 03:53, Xah Lee wrote: >> >> >> >>> On Jun 15, 5:43 am, rusi wrote: On Jun 15, 5:32 pm, Dotan Cohen wrote: >> > Thanks. From testing small movements with my fingers I see that the > fourth finger is i

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improvethe Dvorak Layout?

2011-06-18 Thread rusi
On Jun 19, 9:21 am, Lie Ryan wrote: > On 06/18/11 03:53, Xah Lee wrote: > > > > > On Jun 15, 5:43 am, rusi wrote: > >> On Jun 15, 5:32 pm, Dotan Cohen wrote: > > >>> Thanks. From testing small movements with my fingers I see that the > >>> fourth finger is in fact a bit weaker than the last fing

print header for output

2011-06-18 Thread Cathy James
I managed to get output for my function, thanks much for your direction. I really appreciate the hints. Now I have tried to place the statement "print ("Length \t" + "Count\n")" in different places in my code so that the function can print the headers only one time in this manner: Count Length 4

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Nobody
On Sat, 18 Jun 2011 04:34:55 -0700, mzagu...@gmail.com wrote: > I am wondering what your strategies are for ensuring that data > transmitted to a website via a python program is indeed from that > program, and not from someone submitting POST data using some other > means. > Any remedy? Supply t

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improvethe Dvorak Layout?

2011-06-18 Thread Lie Ryan
On 06/18/11 03:53, Xah Lee wrote: > On Jun 15, 5:43 am, rusi wrote: >> On Jun 15, 5:32 pm, Dotan Cohen wrote: >> >>> Thanks. From testing small movements with my fingers I see that the >>> fourth finger is in fact a bit weaker than the last finger, but more >>> importantly, it is much less dexter

What would you like to see in a File Organizer ?

2011-06-18 Thread zainul franciscus
We are writing a linux file organizer with the code name Cruftbuster. Cruftbuster is an automated file management application for Linux that performs actions on files based on user-defined criteria. For example, if your files in a folder have not been accessed for more than a year and bigger than 2

Re: NEED HELP-process words in a text file

2011-06-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Cathy James wrote: Dear Python Experts, First, I'd like to convey my appreciation to you all for your support and contributions. I am a Python newborn and need help with my function. I commented on my program as to what it should do, but nothing is printing. I know I

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-18 Thread Mark Hammond
On 18/06/2011 1:36 PM, pyt...@bdurham.com wrote: Hi Benjamin, The file info is seems correct but I just checked the MSI and it's reporting that it's 2.7.2. How exactly are you running python.exe and IDLE- are you calling the full path, just calling "python" and using whichever python version i

Re: import from environment path

2011-06-18 Thread Chris Torek
In article <3a2b0261-ee10-40c0-8fad-342f186ee...@q30g2000yqb.googlegroups.com> Guillaume Martel-Genest wrote: >Here's my situation : I got a script a.py that need to call b.py. The >2 scripts can't be in a same package. Script a.py knows the path of >b.py relative to an environment variable B_PAT

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Chris Angelico
On Sun, Jun 19, 2011 at 10:38 AM, Gregory Ewing wrote: > And that only if the attacker isn't a Python programmer. > If he is, he's probably writing his attack program in > Python anyway. :-) > I was thinking you'd have it call on various functions defined elsewhere in the program, forcing him to

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Gregory Ewing
Michael Hrivnak wrote: Besides, it seems that all you've accomplished is verifying that the client can execute python code and you've made it a bit less convenient to attack. And that only if the attacker isn't a Python programmer. If he is, he's probably writing his attack program in Python an

Re: NEED HELP-process words in a text file

2011-06-18 Thread Chris Rebert
On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote: > Dear Python Experts, > > First, I'd like to convey my appreciation to you all for your support > and contributions.  I am a Python newborn and need help with my > function. I commented on my program as to what it should do, but > nothing is pri

Re: NEED HELP-process words in a text file

2011-06-18 Thread Tim Chase
On 06/18/2011 06:21 PM, Cathy James wrote: freq = [] #empty dict to accumulate words and word length While you say you create an empty dict, using "[]" creates an empty *list*, not a dict. Either your comment is wrong or your code is wrong. :) Given your usage, I presume you want a di

Re: NEED HELP-process words in a text file

2011-06-18 Thread Chris Rebert
On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote: > Subject: NEED HELP-process words in a text file > > Dear Python Experts, > > First, I'd like to convey my appreciation to you all for your support > and contributions.  I am a Python newborn and need help with my > function. I commented on my p

NEED HELP-process words in a text file

2011-06-18 Thread Cathy James
Dear Python Experts, First, I'd like to convey my appreciation to you all for your support and contributions. I am a Python newborn and need help with my function. I commented on my program as to what it should do, but nothing is printing. I know I am off, but not sure where. Please help:( impor

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Chris Angelico
On Sun, Jun 19, 2011 at 6:40 AM, Michael Hrivnak wrote: > On Sat, Jun 18, 2011 at 1:26 PM, Chris Angelico wrote: >> SSL certificates are good, but they can be stolen (very easily if the >> client is open source). Anything algorithmic suffers from the same >> issue. > > This is only true if you di

Re: Improper creating of logger instances or a Memory Leak?

2011-06-18 Thread Chris Torek
In article foobar wrote: >I've run across a memory leak in a long running process which I can't >determine if its my issue or if its the logger. You do not say what version of python you are using, but on the other hand I do not know how much the logger code has evolved over time anyway. :-) >

Re: debugging https connections with urllib2?

2011-06-18 Thread Roy Smith
In article <4dfcff48$0$49184$e4fe5...@news.xs4all.nl>, Irmen de Jong wrote: > On 18-6-2011 20:57, Roy Smith wrote: > > We've got a REST call that we're making to a service provider over https > > using urllib2.urlopen(). Is there any way to see exactly what's getting > > sent and received ove

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Terry Reedy
On 6/18/2011 7:34 AM, mzagu...@gmail.com wrote: Hello Folks, I am wondering what your strategies are for ensuring that data transmitted to a website via a python program is indeed from that program, and not from someone submitting POST data using some other means. I find it likely that there is

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Paul Rubin
"mzagu...@gmail.com" writes: > For example, if I create a website that tracks some sort of > statistical information and don't ensure that my program is the one > that is uploading it, the statistics can be thrown off by people > entering false POST data onto the data upload page. Any remedy? If

Re: How do you copy files from one location to another?

2011-06-18 Thread Terry Reedy
On 6/18/2011 1:13 PM, Michael Hrivnak wrote: Python is great for automating sysadmin tasks, but perhaps you should just use rsync for this. It comes with the benefit of only copying the changes instead of every file every time. "rsync -a C:\source E:\destination" and you're done. Perhaps 'syn

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Michael Hrivnak
On Sat, Jun 18, 2011 at 1:26 PM, Chris Angelico wrote: > SSL certificates are good, but they can be stolen (very easily if the > client is open source). Anything algorithmic suffers from the same > issue. This is only true if you distribute your app with one built-in certificate, which does indee

Improper creating of logger instances or a Memory Leak?

2011-06-18 Thread foobar
I've run across a memory leak in a long running process which I can't determine if its my issue or if its the logger. The long and short is I'm doing load testing on an application server which spawns handlers threads which in turn each spawn a single application thread. A graphic representation w

Re: debugging https connections with urllib2?

2011-06-18 Thread Irmen de Jong
On 18-6-2011 20:57, Roy Smith wrote: > We've got a REST call that we're making to a service provider over https > using urllib2.urlopen(). Is there any way to see exactly what's getting > sent and received over the network (i.e. all the HTTP headers) in plain > text? Things like tcpdump and st

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Tim Roberts
"mzagu...@gmail.com" wrote: > >For example, if I create a website that tracks some sort of >statistical information and don't ensure that my program is the one >that is uploading it, the statistics can be thrown off by people >entering false POST data onto the data upload page. Any remedy? The a

debugging https connections with urllib2?

2011-06-18 Thread Roy Smith
We've got a REST call that we're making to a service provider over https using urllib2.urlopen(). Is there any way to see exactly what's getting sent and received over the network (i.e. all the HTTP headers) in plain text? Things like tcpdump and strace only have access to the encrypted data.

Re: Question regarding DNS resolution in urllib2

2011-06-18 Thread Michael Hrivnak
The latest libcurl includes the CURLOPTS_RESOLVE option (http://curl.haxx.se/libcurl/c/curl_easy_setopt.html) that will do what you want. It may not have made its way into pycurl yet, but you could just call the command-line curl binary with the --resolve option. This feature was introduced in ve

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Chris Angelico
On Sat, Jun 18, 2011 at 9:34 PM, mzagu...@gmail.com wrote: > I am wondering what your strategies are for ensuring that data > transmitted to a website via a python program is indeed from that > program, and not from someone submitting POST data using some other > means.  I find it likely that ther

Re: How do you copy files from one location to another?

2011-06-18 Thread Michael Hrivnak
Python is great for automating sysadmin tasks, but perhaps you should just use rsync for this. It comes with the benefit of only copying the changes instead of every file every time. "rsync -a C:\source E:\destination" and you're done. Michael On Fri, Jun 17, 2011 at 1:06 AM, John Salerno wrot

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Michael Hrivnak
Authentication by client SSL certificate is best. You should also look into restricting access on the server side by IP address. Michael On Sat, Jun 18, 2011 at 7:34 AM, mzagu...@gmail.com wrote: > Hello Folks, > > I am wondering what your strategies are for ensuring that data > transmitted to

Re: What's the best way to write this base class?

2011-06-18 Thread Chris Angelico
On Sun, Jun 19, 2011 at 2:26 AM, John Salerno wrote: > The idea of not using a base Character class at all threw me for a > loop though, so I need to think about that too! > It's easy to fall in love with a concept like inheritance, and use it in all sorts of things. You then have a choice to mak

Re: What's the best way to write this base class?

2011-06-18 Thread John Salerno
Whew, thanks for all the responses! I will think about it carefully and decide on a way. I was leaning toward simply assigning the health, resource, etc. variables in the __init__ method, like this: def __init__(self, name): self.name = name self.health = 50 self.resource = 10 I never

porting maatkit to python?

2011-06-18 Thread anand jeyahar
Hi all, I have tried maatkit and was wondering whether it was worth porting maatkit to python. I personally find perl clunky and think python codebase would be easier to maintain, bugfix and enhance. If there is a reasonable amount of interest i can start with some basic functionality(will n

Re: What's the best way to write this base class?

2011-06-18 Thread Ethan Furman
John Salerno wrote: 1) class Character: def __init__(self, name, base_health=50, base_resource=10): self.name = name self.health = base_health self.resource = base_resource You said above that health and resource will never be explicitly passed, yet here you have a

Re: What's the best way to write this base class?

2011-06-18 Thread Ian Kelly
On Sat, Jun 18, 2011 at 7:37 AM, bruno.desthuilli...@gmail.com wrote: > If you go that way, then using polymorphic dispatch might (or not, > depending on the game's rules ) be a good idea: > > > class Character(object): >    BASE_HEALTH = 50 >    ... >    def __init__(self, name): >        ... >  

Re: Python and Lisp : car and cdr

2011-06-18 Thread Nobody
On Fri, 17 Jun 2011 16:45:38 +0200, Franck Ditter wrote: > Hi, I'm just wondering about the complexity of some Python operations > to mimic Lisp car and cdr in Python... > > def length(L) : > if not L : return 0 > return 1 + length(L[1:]) Python's lists are arrays/vectors, not linked lists.

Globalize Management careers.

2011-06-18 Thread gaurav
Site of computer jobs starts with freelance, graphics, data entry too many options in print media make career. http://rojgars1.webs.com/gov.htm http://jobscore.webs.com/retailjob.htm Get careers in Management work. Earn unlimited in Management careers. http://jobshunter.webs.com/index.htm http://

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-18 Thread Ethan Furman
[re-posting to list] pyt...@bdurham.com wrote: Within the folder where the python.exe exists, I have tried the following, all of which report Python 2.7.0 vs. 2.7.2 Confirming I'm running what I think I'm running: import sys sys.hexversion 34013424 sys.executable 'C:\\Python27\\python.ex

Re: What's the best way to write this base class?

2011-06-18 Thread Mel
John Salerno wrote: [ ... ] > 1) > class Character: > def __init__(self, name, base_health=50, base_resource=10): > self.name = name > self.health = base_health > self.resource = base_resource > > 2) > class Character: > base_health = 50 > base_resource = 10 >

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-18 Thread python
Benjamin, I tried uninstalling and re-installing Python 2.7.2 without success ... I kept getting the proper exe's, but when run, the Python version continued to be reported as 2.7.0. Finally I installed for current user only (vs. all users) - the installation now correctly reports my version as 2

Re: What's the best way to write this base class?

2011-06-18 Thread bruno.desthuilli...@gmail.com
On 18 juin, 13:24, Tim Chase wrote: > On 06/18/2011 05:55 AM, bruno.desthuilli...@gmail.com wrote: > > > On 18 juin, 06:17, John Salerno  wrote: > >> class Character: > > >>      base_health = 50 > >>      base_resource = 10 > > >>      def __init__(self, name): > >>          self.name = name > >>

Re: New member intro and question

2011-06-18 Thread mm0fmf
Anthony Papillion wrote: which isn't too shabby but I wonder if it will work. Anything with a 1.2GHz CPU & 512Mb RAM is anything but "extremely resource limited" ;-) I find Python 2.7 runs admirably on a 266MHz PowerPC with only 128MB of ram. -- http://mail.python.org/mailman/listinfo/pyt

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-18 Thread Dotan Cohen
On Sat, Jun 18, 2011 at 14:40, Xah Lee wrote: > very nice review! and on geekhack.org too — the hardcore keyboard mod site! > I enjoyed reading it. > Yes, that is some forum! Wait until I post my mods. You've never seen such abused input devices, I hope. > i only started to use linux this month

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Eden Kirin
On 18.06.2011 13:34, mzagu...@gmail.com wrote: Hello Folks, I am wondering what your strategies are for ensuring that data transmitted to a website via a python program is indeed from that program, and not from someone submitting POST data using some other means. I find it likely that there is

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-18 Thread Xah Lee
On Jun 18, 4:06 am, Dotan Cohen wrote: > On Sat, Jun 18, 2011 at 01:09, Xah Lee wrote: > > thanks. didn't know about Ducky keyboard. Looks good. Also nice to > > hear your experience about Truly Ergonomic keyboard. > > I like it, see my first-hour review > here:http://geekhack.org/showwiki.php?t

Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread mzagu...@gmail.com
Hello Folks, I am wondering what your strategies are for ensuring that data transmitted to a website via a python program is indeed from that program, and not from someone submitting POST data using some other means. I find it likely that there is no solution, in which case what is the best solut

Re: What's the best way to write this base class?

2011-06-18 Thread Tim Chase
On 06/18/2011 05:55 AM, bruno.desthuilli...@gmail.com wrote: On 18 juin, 06:17, John Salerno wrote: class Character: base_health = 50 base_resource = 10 def __init__(self, name): self.name = name self.health = base_health self.resource = base_resource

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-18 Thread Dotan Cohen
On Sat, Jun 18, 2011 at 01:09, Xah Lee wrote: > thanks. didn't know about Ducky keyboard. Looks good. Also nice to > hear your experience about Truly Ergonomic keyboard. > I like it, see my first-hour review here: http://geekhack.org/showwiki.php?title=Island:18154 > no actually i don't know ho

Re: What's the best way to write this base class?

2011-06-18 Thread TheSaint
John Salerno wrote: > class Character: I'd vote to point 1 -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to write this base class?

2011-06-18 Thread bruno.desthuilli...@gmail.com
On 18 juin, 06:17, John Salerno wrote: > Note: I have in mind that when a specific subclass (Warrior, Wizard, > etc.) is created, the only argument that will ever be passed to the > __init__ method is the name. The other variables will never be > explicitly passed, but will be set during initiali

Re: Nimp: Nested Imports (a la Java)

2011-06-18 Thread Tomer Filiba
Stefan Behnel behnel.de> writes: > > So, this isn't really about "nested imports" but rather about merging > distinct packages, right? This allows me to let packages that are stored in > different places appear within their common package prefix. yes, in lack of a better name, i chose "nested

Re: integer to binary 0-padded

2011-06-18 Thread Steven D'Aprano
On Fri, 17 Jun 2011 23:14:09 -0700, jmfauth wrote: '{:+#0{}b}'.format(255, 1 + 2 + 16) > +0b '{:+#0{}b}'.format(-255, 1 + 2 + 16) > -0b eval('{:+#0{}b}'.format(255, 1 + 2 + 16)) > 255 eval('{:+#0{}b}'.format(-255, 1 + 2 + 16)) > -255 Is th

Re: New member intro and question

2011-06-18 Thread Daniel Fetchinson
> > I'm a new list member from the United States. Long time programmer, > fairly new to Python and absolutely loving it so far! I'm 36, live in > Oklahoma, and own a small Linux software development and consulting > firm. Python has made my life a *lot* easier and, the more I learn, > the easier i