Re: Python newbie here! No module named settings

2012-09-07 Thread Jason Friedman
>> I was trying to use Python wrapper for Google Charts API and was >> tweaking the examples. >> https://github.com/gak/pygooglechart/raw/master/examples/pie.py >> >> This is the script which I was trying. >> >> And the python interpreter gives the following error: >> import settings >> ImportE

Re: Comparing strings from the back?

2012-09-07 Thread Dwight Hutto
Why don' you just time it,eit lops through incrementing thmax input/ -- Best Regards, David Hutto *CEO:* *http://www.hitwebdevelopment.com* -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-07 Thread Steven D'Aprano
On Fri, 07 Sep 2012 19:10:16 +, Oscar Benjamin wrote: > On 2012-09-07, Steven D'Aprano > wrote: >> >> >> After further thought, and giving consideration to the arguments given >> by people here, I'm now satisfied to say that for equal-length strings, >> string equality is best described as O

Re: how to run python2.6 module with absolute imports stand alone

2012-09-07 Thread Mark Lawrence
On 07/09/2012 23:04, Gelonida N wrote: Hi, many of my modules contain following section at the end def main(): do_something() if __name__ == '__main__': main() This allows me to run some basic example code or some small test in a stand alone mode. My new modules contain following

Re: Comparing strings from the back?

2012-09-07 Thread Dwight Hutto
On Fri, Sep 7, 2012 at 5:59 PM, Dwight Hutto wrote: > With unequal strings/lists to match, it would seem that one would regex > through the larger string/list with the shorter string, and piece by piece > begin to match for partial percentage matches in relation to the longer > iterative item. >

how to run python2.6 module with absolute imports stand alone

2012-09-07 Thread Gelonida N
Hi, many of my modules contain following section at the end def main(): do_something() if __name__ == '__main__': main() This allows me to run some basic example code or some small test in a stand alone mode. My new modules contain following line at the beginning: from __future__ im

Re: Comparing strings from the back?

2012-09-07 Thread Dwight Hutto
With unequal strings/lists to match, it would seem that one would regex through the larger string/list with the shorter string, and piece by piece begin to match for partial percentage matches in relation to the longer iterative item. -- Best Regards, David Hutto *CEO:* *http://www.hitwebdevelopm

Re: Using Raw Data in NLTK

2012-09-07 Thread Terry Reedy
On 9/7/2012 3:02 PM, subhabangal...@gmail.com wrote: Dear Group, I am trying to use NLTK and its statistical classifiers. The system is working fine but I am trying to use my own data, instead of things like, from nltk.corpus import brown from nltk.corpus import names If any one can kindly gui

Re: Dynamically scheduling Cron Jobs for Python Scripts.

2012-09-07 Thread Michael Ströder
Miki Tebeka wrote: >> I want to re run the script at that schedule time to send me a email. > > Calculate how much time until the meeting. And spawn the script that will > sleep that amount of time and then send email. And if the process gets interrupted in the meantime (e.g. because of reboot)?

Re: Comparing strings from the back?

2012-09-07 Thread Oscar Benjamin
On 2012-09-07, Oscar Benjamin wrote: > On 2012-09-07, Steven D'Aprano wrote: >> > > Since string comparison is only useful if the strings can be equal or unequal, > the average case depends on how often they are equal/unequal as well as the > average complexity of both. For random strings the fr

Re: Comparing strings from the back?

2012-09-07 Thread Oscar Benjamin
On 2012-09-07, Steven D'Aprano wrote: > > > After further thought, and giving consideration to the arguments given by > people here, I'm now satisfied to say that for equal-length strings, > string equality is best described as O(N). > > 1) If the strings are equal, a == b will always compare a

Re: ctypes - python2.7.3 vs python3.2.3

2012-09-07 Thread John Gordon
In <9a74$503e88dd$546bb230$30...@cache80.multikabel.net> Jan Kuiken writes: > >> uint32_t myfunction (char ** _mydata) > >> { > >> char mydata[16]; > > > >> strcpy(mydata, "Hello Dude!"); > > > >> *_mydata = mydata; > > > >> return 0; > >> } > > > > mydata is an auto variable, wh

Using Raw Data in NLTK

2012-09-07 Thread subhabangalore
Dear Group, I am trying to use NLTK and its statistical classifiers. The system is working fine but I am trying to use my own data, instead of things like, from nltk.corpus import brown from nltk.corpus import names If any one can kindly guide me up. Thanks in Advance, Regards, Subhabrata. --

Re: Division help in python

2012-09-07 Thread Serhiy Storchaka
On 07.09.12 15:53, Ramyasri Dodla wrote: > I am brand new to python. checking over basic stuff. I came across the > problem while doing so. If any body aware of the problem, kindly respond me. > > >>> 5/10 > 0 > >>> - 5/10 > -1 > > The second case also should yield a 'zero' but it is giving a

Re: Reusable (local) Modules

2012-09-07 Thread Dave Angel
On 09/07/2012 01:56 PM, Travis Griggs wrote: > I'm relatively new to Python (coming from strong C and Smalltalk > backgrounds). I've written a couple of relatively small apps (one or two .py > files). I'm using PyCharm (I love it). > > I'm curious what the pythonic approach is to creating your ow

Re: Reusable (local) Modules

2012-09-07 Thread Dave Angel
On 09/07/2012 01:56 PM, Travis Griggs wrote: > I'm relatively new to Python (coming from strong C and Smalltalk > backgrounds). I've written a couple of relatively small apps (one or two .py > files). I'm using PyCharm (I love it). > > I'm curious what the pythonic approach is to creating your ow

Reusable (local) Modules

2012-09-07 Thread Travis Griggs
I'm relatively new to Python (coming from strong C and Smalltalk backgrounds). I've written a couple of relatively small apps (one or two .py files). I'm using PyCharm (I love it). I'm curious what the pythonic approach is to creating your own reusable modules. Any tutorials or high level expla

Re: Accessing dll

2012-09-07 Thread Helpful person
On Sep 7, 5:16 am, Chris Angelico wrote: > On Fri, Sep 7, 2012 at 1:44 AM, Helpful person wrote: > > FYI > > > My Python version is 2.5.4 > > You may wish to upgrade, that's quite an old version. Unless > something's binding you to version 2.x, I would strongly recommend > migrating to 3.2 or 3.3

Re: Bitshifts and "And" vs Floor-division and Modular

2012-09-07 Thread Dave Angel
On 09/07/2012 12:59 PM, rusi wrote: > On Sep 7, 9:32 am, Paul Rubin wrote: >> rusi writes: >>> On an 8086/8088 a MUL (multiply) instruction was of the order of 100 >>> clocks ... On most modern processors (after the pentium) the >>> difference has mostly vanished. I cant find a good data sheet

Re: Bitshifts and "And" vs Floor-division and Modular

2012-09-07 Thread rusi
On Sep 7, 9:32 am, Paul Rubin wrote: > rusi writes: > > On an 8086/8088 a MUL (multiply) instruction was of the order of 100 > > clocks ...  On most modern processors (after the pentium) the > > difference has mostly vanished.  I cant find a good data sheet to > > quote though > > See http://www.

Re: Division help in python

2012-09-07 Thread Jean-Michel Pichavant
Ramyasri Dodla wrote: Hi All, I am brand new to python. checking over basic stuff. I came across the problem while doing so. If any body aware of the problem, kindly respond me. >>> 5/10 0 >>> - 5/10 -1 The second case also should yield a 'zero' but it is giving a -1 Why should it yield '

Re: Defining features in a list

2012-09-07 Thread Dave Angel
On 09/07/2012 11:21 AM, M Whitman wrote: > Dave- By features I was refering to items in the list. For background the > arcpy module is used for geoprocessing of geographic information. I'm using > my script to get totals for features in a dataset that I receive on a regular > basis- for exampl

Re: Defining features in a list

2012-09-07 Thread Jean-Michel Pichavant
M Whitman wrote: Good Morning, I have been recently trying to define all of the features in a list but have been running into errors. I would like to define the features similar to the following print statement. Any advice would be appreciated. I'm trying to transition my output from a tex

Re: Defining features in a list

2012-09-07 Thread M Whitman
Dave- By features I was refering to items in the list. For background the arcpy module is used for geoprocessing of geographic information. I'm using my script to get totals for features in a dataset that I receive on a regular basis- for example total number of hydrants, total number of hydra

Re: Defining features in a list

2012-09-07 Thread Dave Angel
On 09/07/2012 09:42 AM, M Whitman wrote: > Good Morning, > > I have been recently trying to define all of the features in a list but have > been running into errors. How proficient are you in Python? Could you possibly use terms which make sense to someone who doesn't know this arcGIS program?

Re: Function for examine content of directory

2012-09-07 Thread Tigerstyle
Ok I'm now totally stuck. This is the code: --- import os from collections import Counter path = ":c\\mypath\dir" dirs = os.listdir( path ) filenames = {"this.txt", "that.txt", "the_other.txt","this.doc","that.doc","this.pdf","first.txt","that.pdf"} extensions = [] for filename in filenames:

Re: Function for examine content of directory

2012-09-07 Thread Tigerstyle
kl. 16:56:29 UTC+2 torsdag 6. september 2012 skrev Tigerstyle følgende: > Hi guys, > > > > I'm trying to write a module containing a function to examine the contents of > the current working directory and print out a count of how many files have > each extension (".txt", ".doc", etc.) > > >

Re: Bitshifts and "And" vs Floor-division and Modular

2012-09-07 Thread Grant Edwards
On 2012-09-07, Steven D'Aprano wrote: > My *guess* is that you mean *bitwise* operators, compared to numeric > operators like * and // (integer division). The runtime cost is mostly > dominated by the object-oriented overhead -- Python is not C or assembly, > and the integers are rich objects,

Defining features in a list

2012-09-07 Thread M Whitman
Good Morning, I have been recently trying to define all of the features in a list but have been running into errors. I would like to define the features similar to the following print statement. Any advice would be appreciated. I'm trying to transition my output from a text file to excel and

Re: Bitshifts and "And" vs Floor-division and Modular

2012-09-07 Thread Mark Lawrence
On 07/09/2012 02:08, Cameron Simpson wrote: On 07Sep2012 01:30, Mark Lawrence wrote: | On 07/09/2012 01:01, jimbo1qaz wrote: | > Is it faster to use bitshifts or floor division? And which is better, & or %? | > All divisors and mods are power of 2, so are binary operations faster? And are they

Re: How to print something only if it exists?

2012-09-07 Thread Roy Smith
In article <9s4nh9-8dr@chris.zbmc.eu>, tinn...@isbd.co.uk wrote: > I want to print a series of list elements some of which may not exist, > e.g. I have a line:- > > print day, fld[1], balance, fld[2] > > fld[2] doesn't always exist (fld is the result of a split) so the > print fails whe

Re: Division help in python

2012-09-07 Thread Chris Angelico
On Fri, Sep 7, 2012 at 10:53 PM, Ramyasri Dodla wrote: > I am brand new to python. checking over basic stuff. I came across the > problem while doing so. If any body aware of the problem, kindly respond me. > 5/10 > 0 - 5/10 > -1 > > The second case also should yield a 'zero' but it is g

Division help in python

2012-09-07 Thread Ramyasri Dodla
Hi All, I am brand new to python. checking over basic stuff. I came across the problem while doing so. If any body aware of the problem, kindly respond me. >>> 5/10 0 >>> - 5/10 -1 The second case also should yield a 'zero' but it is giving a -1 some other examples for your review. >>> -10/5 -

Re: Accessing dll

2012-09-07 Thread Chris Angelico
On Fri, Sep 7, 2012 at 1:44 AM, Helpful person wrote: > FYI > > My Python version is 2.5.4 You may wish to upgrade, that's quite an old version. Unless something's binding you to version 2.x, I would strongly recommend migrating to 3.2 or 3.3. ChrisA -- http://mail.python.org/mailman/listinfo/p

Re: Python newbie here! No module named settings

2012-09-07 Thread chandraganeshchowdary
On Thursday, June 2, 2011 8:59:48 PM UTC+5:30, Neeraj Agarwal wrote: > Hello all, > > I'm a newbie to Python and its my 2nd day exploring it. > > I was trying to use Python wrapper for Google Charts API and was > tweaking the examples. > https://github.com/gak/pygooglechart/raw/master/examples/pi

Re: How to print something only if it exists?

2012-09-07 Thread Hans Mulder
On 6/09/12 19:59:05, tinn...@isbd.co.uk wrote: > I want to print a series of list elements some of which may not exist, > e.g. I have a line:- > > print day, fld[1], balance, fld[2] > > fld[2] doesn't always exist (fld is the result of a split) so the > print fails when it isn't set. How ab