Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread ruck
On Thursday, September 6, 2012 7:05:39 PM UTC-7, Terry Reedy wrote: > On 9/6/2012 8:55 PM, ruck wrote: > > > (This with Python 2.7.2 on Windows 7) > > > > > > os.stat() won't recognize a filename ending in period. > > > It will ignore trailing periods. > > > If you ask it about file 'goo...' i

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

2012-09-06 Thread Paul Rubin
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.agner.org/optimize/ : 4. Instruction tables: L

Re: Comparing strings from the back?

2012-09-06 Thread Steven D'Aprano
On Thu, 06 Sep 2012 06:07:38 -0400, Dave Angel wrote: > On 09/06/2012 04:33 AM, Steven D'Aprano wrote: >> >> >> I may have been overly-conservative earlier when I said that on average >> string equality has to compare half the characters. I thought I had >> remembered that from a computer science

Re: Comparing strings from the back?

2012-09-06 Thread Steven D'Aprano
On Fri, 07 Sep 2012 00:39:33 +1000, Chris Angelico wrote: > On Thu, Sep 6, 2012 at 11:37 PM, Johannes Bauer > wrote: >> Not in my original post. If you read it again, you will clearly see >> that I was talking about purely random strings. And since you like to >> nitpick, I'll clarify further: I'

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

2012-09-06 Thread rusi
On Sep 7, 5:01 am, 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 considered bad style? On an 8086/8088 a MUL (multiply) instruction was of the order of 100 c

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread Ian Kelly
On Thu, Sep 6, 2012 at 6:55 PM, ruck wrote: > (This with Python 2.7.2 on Windows 7) > > os.stat() won't recognize a filename ending in period. > It will ignore trailing periods. > If you ask it about file 'goo...' it will report on file 'goo' > And if 'goo' doesn't exist, os.stat will complain. D

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread ruck
On Thursday, September 6, 2012 6:49:43 PM UTC-7, alex23 wrote: > On Sep 7, 10:55 am, ruck wrote: > > > (This with Python 2.7.2 on Windows 7) > > > rename goo to "goo...", then, > > > > I'm unable to rename any file to have a '...' suffix, are you certain > > the file exists in the form you t

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread Steven D'Aprano
On Thu, 06 Sep 2012 17:55:02 -0700, ruck wrote: > (This with Python 2.7.2 on Windows 7) > > os.stat() won't recognize a filename ending in period. It will ignore > trailing periods. > If you ask it about file 'goo...' it will report on file 'goo' And if > 'goo' doesn't exist, os.stat will complai

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

2012-09-06 Thread Steven D'Aprano
On Thu, 06 Sep 2012 18:30:48 -0700, jimbo1qaz wrote: > OK, I decided to change my code. Which raises a similar question: Which > one is better for setting a bit of a byte: |= or +=, assuming each will > only be run once? Intuitively, I think |= Python (like most languages) doesn't have a "set thi

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Terry Reedy
On 9/6/2012 3:44 PM, Thomas Jollans wrote: On 09/06/2012 09:27 PM, John Nagle wrote: In Python 2.7: I want to parse standard ISO date/time strings such as 2012-09-09T18:00:00-07:00 into Python "datetime" objects. The "datetime" object offers an output method , datetimeobj.isoform

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread Terry Reedy
On 9/6/2012 8:55 PM, ruck wrote: (This with Python 2.7.2 on Windows 7) os.stat() won't recognize a filename ending in period. It will ignore trailing periods. If you ask it about file 'goo...' it will report on file 'goo' And if 'goo' doesn't exist, os.stat will complain. create file goo, then

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

2012-09-06 Thread Steven D'Aprano
On Thu, 06 Sep 2012 17:01:12 -0700, jimbo1qaz wrote: > Is it faster to use bitshifts or floor division? Does it matter? If you ever find yourself writing an application where the difference between 0.0476 microseconds and 0.0473 microseconds matters to you, Python is probably the wrong langua

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

2012-09-06 Thread Terry Reedy
On 9/6/2012 8:01 PM, 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 considered bad style? Yes, meaningless, yes, and no. I would do what seems sensible to you in t

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread ruck
On Thursday, September 6, 2012 6:19:11 PM UTC-7, Dave Angel wrote: > On 09/06/2012 08:55 PM, ruck wrote: > > > (This with Python 2.7.2 on Windows 7) > > > > > > os.stat() won't recognize a filename ending in period. > > > It will ignore trailing periods. > > > If you ask it about file 'goo..

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread alex23
On Sep 7, 10:55 am, ruck wrote: > (This with Python 2.7.2 on Windows 7) > rename goo to "goo...", then, I'm unable to rename any file to have a '...' suffix, are you certain the file exists in the form you think after the rename? -- http://mail.python.org/mailman/listinfo/python-list

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

2012-09-06 Thread Dave Angel
On 09/06/2012 09:30 PM, jimbo1qaz wrote: > On Thursday, September 6, 2012 5:01:12 PM UTC-7, 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 considered bad

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-09-06 Thread Alex
Terry Reedy wrote: [snip] > IDLE is not the interpreter. Fine, I meant shell. Thanks for fixing that for me. > The IDLE Shell is intended mainly for single-line inputs. Maybe it should be limited to that, then. That way stoopid noobs like me don't use it wrong and then use the wrong nomencla

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

2012-09-06 Thread Dave Angel
On 09/06/2012 08:01 PM, jimbo1qaz wrote: > Is it faster to use bitshifts or floor division? Yes, and yes. Without doing any measurement, I'd expect that in CPython, it makes negligible performance difference for ordinary ints (under 2**31, more or less). Ordinary ints can be done with single inst

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

2012-09-06 Thread jimbo1qaz
On Thursday, September 6, 2012 5:01:12 PM UTC-7, 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 considered bad style? OK, I decided to change my code. Which

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread Dwight Hutto
On Thu, Sep 6, 2012 at 8:55 PM, ruck wrote: > (This with Python 2.7.2 on Windows 7) > > os.stat() won't recognize a filename ending in period. > It will ignore trailing periods. > If you ask it about file 'goo...' it will report on file 'goo' > And if 'goo' doesn't exist, os.stat will complain. >

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread Dave Angel
On 09/06/2012 08:55 PM, ruck wrote: > (This with Python 2.7.2 on Windows 7) > > os.stat() won't recognize a filename ending in period. > It will ignore trailing periods. > If you ask it about file 'goo...' it will report on file 'goo' > And if 'goo' doesn't exist, os.stat will complain. > > creat

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

2012-09-06 Thread Cameron Simpson
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 considered bad style? | | Why don't you use

Re: lxml can't output right unicode result

2012-09-06 Thread MRAB
On 07/09/2012 01:21, contro opinion wrote: i eidt a file and save it in gbk encode named test. my system is :debian,locale,en.utf-8;python2.6,locale,utf-8. 你 in terminal i input: xxd test 000: 3c68 746d 6c3e 0a3c 703e c4e3 3c2f 703e ... 010: 0a3c 2f68 746d 6c3e 0a

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

2012-09-06 Thread jimbo1qaz
On Thursday, September 6, 2012 5:30:05 PM UTC-7, 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 con

os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread ruck
(This with Python 2.7.2 on Windows 7) os.stat() won't recognize a filename ending in period. It will ignore trailing periods. If you ask it about file 'goo...' it will report on file 'goo' And if 'goo' doesn't exist, os.stat will complain. create file goo, then >>> os.stat('goo') nt.st

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

2012-09-06 Thread Mark Lawrence
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 considered bad style? Why don't you use the timeit module and find out for yourself? -- Chee

lxml can't output right unicode result

2012-09-06 Thread contro opinion
i eidt a file and save it in gbk encode named test. my system is :debian,locale,en.utf-8;python2.6,locale,utf-8. 你 in terminal i input: xxd test 000: 3c68 746d 6c3e 0a3c 703e c4e3 3c2f 703e ... 010: 0a3c 2f68 746d 6c3e 0a .. 你 is you in english, "\xc4\xe3" is the

Bitshifts and "And" vs Floor-division and Modular

2012-09-06 Thread jimbo1qaz
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 considered bad style? -- http://mail.python.org/mailman/listinfo/python-list

Re: HP Quality Center only works with ActiveState Python 2.5

2012-09-06 Thread Dwight Hutto
On Thu, Sep 6, 2012 at 6:12 PM, wrote: > Does anyone know why this is? I cannot find anything via Google about > this, but HP says it is so. Of course it is now impossible to get > ActiveState Python 2.5 for free. You can spend a $1000 for a copy. :) > > Anyway, it is irritating me that we a

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Roy Smith
In article , Dave Angel wrote: > For working with datetime, see > http://docs.python.org/library/datetime.html#datetime.datetime > > and look up datetime.strptime() strptime has two problems. One is that it's a pain to use (you have to look up all those inscrutable %-thingies every time

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Roy Smith
In article , John Nagle wrote: > In Python 2.7: > >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , datetimeobj.isoformat(), but not an input > parser. There o

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Miki Tebeka
I'd look also into dateutil.parser.parse and feedparser._parse_date On Thursday, September 6, 2012 1:34:18 PM UTC-7, John Nagle wrote: > On 9/6/2012 12:51 PM, Paul Rubin wrote: > > > John Nagle writes: > > >> There's an iso8601 module on PyPi, but it's abandoned; it hasn't been > > >> updated

HP Quality Center only works with ActiveState Python 2.5

2012-09-06 Thread bbeacham
Does anyone know why this is? I cannot find anything via Google about this, but HP says it is so. Of course it is now impossible to get ActiveState Python 2.5 for free. You can spend a $1000 for a copy. :) Anyway, it is irritating me that we are starting a new automation environment in Pyt

Re: Function for examine content of directory

2012-09-06 Thread Chris Angelico
On Fri, Sep 7, 2012 at 12:56 AM, Tigerstyle wrote: > 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.) If you haven't already, look into the Python 'd

Re: A Python class

2012-09-06 Thread Chris Angelico
On Fri, Sep 7, 2012 at 3:30 AM, Terry Reedy wrote: > On 9/6/2012 11:08 AM, Yves S. Garret wrote: > >> I'd like to know if there are any online Python classes offered >> online from reliable institutions that you would recommend. > > Google 'online programming course python' for taught courses.

Re: Looking for an IPC solution

2012-09-06 Thread Dave Angel
On 09/06/2012 04:33 PM, Dennis Lee Bieber wrote: > > Note that this difference mainly applies to how the processes are > themselves are created... How the library wraps shared data is > possibly different (I've never understood how a "fork" process can > avoid memory conflicts if it has write acc

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread John Nagle
On 9/6/2012 12:51 PM, Paul Rubin wrote: > John Nagle writes: >> There's an iso8601 module on PyPi, but it's abandoned; it hasn't been >> updated since 2007 and has many outstanding issues. > > Hmm, I have some code that uses ISO date/time strings and just checked > to see how I did it, and it loo

Re: Accessing dll

2012-09-06 Thread Tim Williams
On Thursday, September 6, 2012 4:21:56 PM UTC-4, Tim Williams wrote: > On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > > > I am a complete novice to Python. I wish to access a dll that has > > > > > > been written to be compatible with C and VB6. I have been told tha

Re: Function for examine content of directory

2012-09-06 Thread Tigerstyle
Thanks, just what I was looking for :-) T kl. 17:20:27 UTC+2 torsdag 6. september 2012 skrev MRAB følgende: > On 06/09/2012 15:56, Tigerstyle wrote: > > > Hi guys, > > > > > > I'm trying to write a module containing a function to examine the contents > > of the current working directory and p

Re: Accessing dll

2012-09-06 Thread Tim Williams
On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > I am a complete novice to Python. I wish to access a dll that has > > been written to be compatible with C and VB6. I have been told that > > after running Python I should enter "from ctypes import *" which > > allows P

Re: Dynamically scheduling Cron Jobs for Python Scripts.

2012-09-06 Thread Miki Tebeka
> 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. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Dave Angel
On 09/06/2012 03:27 PM, John Nagle wrote: > In Python 2.7: > >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , datetimeobj.isoformat(), but not an input > parser. Th

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Paul Rubin
John Nagle writes: > There's an iso8601 module on PyPi, but it's abandoned; it hasn't been > updated since 2007 and has many outstanding issues. Hmm, I have some code that uses ISO date/time strings and just checked to see how I did it, and it looks like it uses iso8601-0.1.4-py2.6.egg . I don't

Re: How to print something only if it exists?

2012-09-06 Thread Joshua Landau
On 6 September 2012 18:59, 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. > What I might do i

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Thomas Jollans
On 09/06/2012 09:27 PM, John Nagle wrote: > In Python 2.7: > >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , datetimeobj.isoformat(), but not an input > parser.

Re: Language workbench written in python3

2012-09-06 Thread Nestor Arocha
On Thursday, September 6, 2012 2:53:15 PM UTC+1, Ramchandra Apte wrote: > On Thursday, 6 September 2012 19:16:38 UTC+5:30, Dave Angel wrote: > > > On 09/06/2012 09:34 AM, Ramchandra Apte wrote: > > > > > > > Translator means what precisely? > > > > > > > > > > > > Examples of translator

Re: How to print something only if it exists?

2012-09-06 Thread Terry Reedy
On 9/6/2012 1:59 PM, 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. What fails is th

Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread John Nagle
In Python 2.7: I want to parse standard ISO date/time strings such as 2012-09-09T18:00:00-07:00 into Python "datetime" objects. The "datetime" object offers an output method , datetimeobj.isoformat(), but not an input parser. There ought to be classmethod datetime.fromisofo

Re: python docs search for 'print'

2012-09-06 Thread Terry Reedy
On 9/6/2012 10:01 AM, David Hoese wrote: On 9/5/12 3:03 PM, Grant Edwards wrote: On 2012-09-05, Dave Angel wrote: >On 09/05/2012 01:47 PM, Grant Edwards wrote: > >>Making the site's "search" box use Google or somesuch is probably the >>simplest solution. I'm not enough of a web guy to know ho

Re: python docs search for 'print'

2012-09-06 Thread Mark Lawrence
On 06/09/2012 15:01, David Hoese wrote: On 9/5/12 3:03 PM, Grant Edwards wrote: On 2012-09-05, Dave Angel wrote: >On 09/05/2012 01:47 PM, Grant Edwards wrote: > >>Making the site's "search" box use Google or somesuch is probably the >>simplest solution. I'm not enough of a web guy to know how

Re: How to print something only if it exists?

2012-09-06 Thread Dave Angel
On 09/06/2012 01:59 PM, 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. > > I

Re: How to print something only if it exists?

2012-09-06 Thread Emile van Sebille
On 9/6/2012 10:59 AM tinn...@isbd.co.uk said... 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. I know I could s

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-09-06 Thread Terry Reedy
On 9/6/2012 9:43 AM, Alex wrote: On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex wrote: I'm new to Python and have been using IDLE 3.2.3 to experiment with code as I learn. Despite being configured to use a 4 space indentation width, sometimes IDLE's "smart" indentation insists >>> upon

How to print something only if it exists?

2012-09-06 Thread tinnews
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. I know I could simply use an if but ultimately there may be more el

Re: A Python class

2012-09-06 Thread Terry Reedy
On 9/6/2012 11:08 AM, Yves S. Garret wrote: I'd like to know if there are any online Python classes offered online from reliable institutions that you would recommend. Google 'online programming course python' for taught courses. At least 2 of MIT's self-guided OpenCourseWare courses use P

Re: Accessing dll

2012-09-06 Thread MRAB
On 06/09/2012 17:58, Jerry Hill wrote: On Thu, Sep 6, 2012 at 12:46 PM, Helpful person wrote: The reference might help if I could get Python to recognize the dll as a module. That's never going to happen. It's a DLL, not a python module. I think the documentation lays that out pretty explic

Re: Accessing dll

2012-09-06 Thread Helpful person
On Sep 6, 9:58 am, Jerry Hill wrote: What do you get if you do the following at the > interactive interpreter? > > >>> from ctypes import * > >>> print windll. > > -- > Jerry I get: , handle 41 at 2ace070> -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing dll

2012-09-06 Thread Jerry Hill
On Thu, Sep 6, 2012 at 12:46 PM, Helpful person wrote: > The reference might help if I could get Python to recognize the dll as > a module. That's never going to happen. It's a DLL, not a python module. I think the documentation lays that out pretty explicitly. Have you experimented with the v

Re: Accessing dll

2012-09-06 Thread Helpful person
On Sep 6, 8:30 am, Jerry Hill wrote: > > You should start by reading the ctypes documentation, > here:http://docs.python.org/library/ctypes.html.  It has a lot of examples > that ought to get you started. > The reference might help if I could get Python to recognize the dll as a module. -- http

Re: Accessing dll

2012-09-06 Thread Helpful person
On Sep 6, 8:28 am, Ulrich Eckhardt wrote: > Am 06.09.2012 17:07, schrieb Helpful person: > > > I am a complete novice to Python. > > Welcome! > > > I wish to access a dll that has > > been written to be compatible with C and VB6.  I have been told that > > after running Python I should enter  "fro

Re: Accessing dll

2012-09-06 Thread Ulrich Eckhardt
Am 06.09.2012 17:07, schrieb Helpful person: I am a complete novice to Python. Welcome! I wish to access a dll that has been written to be compatible with C and VB6. I have been told that after running Python I should enter "from ctypes import *" which allows Python to recognize the dll str

Re: Comparing strings from the back?

2012-09-06 Thread Dave Angel
On 09/06/2012 10:42 AM, Johannes Bauer wrote: > On 06.09.2012 16:23, Dave Angel wrote: >> On 09/06/2012 09:43 AM, Johannes Bauer wrote: >>> >>> Yes, worst-case is O(N), best case O(1). Average is O(n log n). >> Can't see how you came up with an average of n log(n). Fourteen minutes >> before you

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 17:36, Johannes Bauer wrote: > "pleasedumpstats" < "" And against a XML-reading C code generator that uses mako: strCmpEq 39670 strCmpLt 2766215 strCmpGt 2744002 strCmpTc 37430821 strCmpCc 14048656 Compared strings: 5549887 Equal: 0.7% Average wordlength: 6.74 chars Average compare

Re: Accessing dll

2012-09-06 Thread Helpful person
On Sep 6, 8:30 am, Jerry Hill wrote: > You should start by reading the ctypes documentation, > here:http://docs.python.org/library/ctypes.html.  It has a lot of examples > that ought to get you started. > > When you run into more specific problems, you're going to have to > provide a lot more inf

Re: Accessing dll

2012-09-06 Thread Helpful person
FYI My Python version is 2.5.4 -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 16:39, Chris Angelico wrote: > In any case, it'll be far FAR more useful than arguing from > totally random, or random word selection, or anything. > > Who's game? Okay, patched against Python 3.2.3: http://pastebin.com/PRRN53P6 To invoke display of the stats, compare the string "

Re: Accessing dll

2012-09-06 Thread Jerry Hill
On Thu, Sep 6, 2012 at 11:07 AM, Helpful person wrote: > I am a complete novice to Python. I wish to access a dll that has > been written to be compatible with C and VB6. I have been told that > after running Python I should enter "from ctypes import *" which > allows Python to recognize the dl

Re: Accessing dll

2012-09-06 Thread Benjamin Kaplan
On Sep 6, 2012 8:15 AM, "Helpful person" wrote: > > I am a complete novice to Python. I wish to access a dll that has > been written to be compatible with C and VB6. I have been told that > after running Python I should enter "from ctypes import *" which > allows Python to recognize the dll str

Re: Function for examine content of directory

2012-09-06 Thread MRAB
On 06/09/2012 15:56, Tigerstyle wrote: 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.) This is the code so far: -- import os path = "v:\\wor

Accessing dll

2012-09-06 Thread Helpful person
I am a complete novice to Python. I wish to access a dll that has been written to be compatible with C and VB6. I have been told that after running Python I should enter "from ctypes import *" which allows Python to recognize the dll structure. I have placed the dll into my active directory (if

Re: Function for examine content of directory

2012-09-06 Thread Ian Foote
On 06/09/12 15:56, Tigerstyle wrote: 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.) This is the code so far: -- import os path = "v:\\wo

Function for examine content of directory

2012-09-06 Thread Tigerstyle
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.) This is the code so far: -- import os path = "v:\\workspace\\Python2_Homework03\\src\\" dirs

Re: Comparing strings from the back?

2012-09-06 Thread Chris Angelico
On Thu, Sep 6, 2012 at 11:37 PM, Johannes Bauer wrote: > Not in my original post. If you read it again, you will clearly see that > I was talking about purely random strings. And since you like to > nitpick, I'll clarify further: I'm talking about bitstrings in which > every bit of every character

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 16:23, Dave Angel wrote: > On 09/06/2012 09:43 AM, Johannes Bauer wrote: >> >> Yes, worst-case is O(N), best case O(1). Average is O(n log n). > > Can't see how you came up with an average of n log(n). Fourteen minutes > before you made this post, you demonstrated it was less than

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 15:43, Johannes Bauer wrote: > Wrong, at least for randomized strings (i.e. every character with the > same probability). O(N) is worst-case, O(log N) is correct for > randomized strings. ^^ Here I write the right thing. Then further below... > Yes, worst-case is O(N), best case O(1

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 16:23, Dave Angel wrote: > On 09/06/2012 09:43 AM, Johannes Bauer wrote: >> >> Yes, worst-case is O(N), best case O(1). Average is O(n log n). > > Can't see how you came up with an average of n log(n). Fourteen minutes > before you made this post, you demonstrated it was less than

Re: Language workbench written in python3

2012-09-06 Thread Dave Angel
On 09/06/2012 09:53 AM, Ramchandra Apte wrote: > On Thursday, 6 September 2012 19:16:38 UTC+5:30, Dave Angel wrote: >> On 09/06/2012 09:34 AM, Ramchandra Apte wrote: >> >>> Translator means what precisely? >> >> >> Examples of translators include compilers, assemblers, and >> >> interpreters. The

Re: Comparing strings from the back?

2012-09-06 Thread Dave Angel
On 09/06/2012 09:43 AM, Johannes Bauer wrote: > > Yes, worst-case is O(N), best case O(1). Average is O(n log n). Can't see how you came up with an average of n log(n). Fourteen minutes before you made this post, you demonstrated it was less than 2 for any N. And I previously posted that for a

python docs search for 'print'

2012-09-06 Thread David Hoese
On 9/5/12 3:03 PM, Grant Edwards wrote: On 2012-09-05, Dave Angel wrote: >On 09/05/2012 01:47 PM, Grant Edwards wrote: > >>Making the site's "search" box use Google or somesuch is probably the >>simplest solution. I'm not enough of a web guy to know how to do >>that, but I do know that some si

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-09-06 Thread Ramchandra Apte
On Thursday, 6 September 2012 19:13:23 UTC+5:30, Alex wrote: > Ramchandra Apte wrote: > > > > > On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex wrote: > > > > I'm new to Python and have been using IDLE 3.2.3 to experiment with > > > > > > > > code as I learn. Despite being configured t

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-09-06 Thread Alex
Ramchandra Apte wrote: > On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex wrote: > > I'm new to Python and have been using IDLE 3.2.3 to experiment with > > > > code as I learn. Despite being configured to use a 4 space > > indentation > > > > width, sometimes IDLE's "smart" indentation insi

Re: Language workbench written in python3

2012-09-06 Thread Ramchandra Apte
On Thursday, 6 September 2012 19:16:38 UTC+5:30, Dave Angel wrote: > On 09/06/2012 09:34 AM, Ramchandra Apte wrote: > > > Translator means what precisely? > > > > Examples of translators include compilers, assemblers, and > > interpreters. They also include implementations like cfront, which

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 10:33, Steven D'Aprano wrote: > But you know, it really doesn't make a difference. Equality testing will > *still* be O(N) since the asymptomatic behaviour for sufficiently large > string comparisons will be bounded by O(N). Multiplicative constants > ("half the string" versus "0.

Re: Setting up a class

2012-09-06 Thread Colin J. Williams
On 06/09/2012 8:20 AM, MRAB wrote: On 06/09/2012 13:00, shaun wrote: Hi all, So I'm trying to to OO a script which is currently in place on work. It connects to the database and makes multiple strings and sends them to a server. But I'm having major problems since I am new to python I keep try

Re: Language workbench written in python3

2012-09-06 Thread Dave Angel
On 09/06/2012 09:34 AM, Ramchandra Apte wrote: > Translator means what precisely? Examples of translators include compilers, assemblers, and interpreters. They also include implementations like cfront, which translates from one high-level language to another lower-level language. (high and low b

Re: Setting up a class

2012-09-06 Thread Dave Angel
On 09/06/2012 08:00 AM, shaun wrote: > Hi all, > > So I'm trying to to OO a script which is currently in place on work. It > connects to the database and makes multiple strings and sends them to a > server. > > But I'm having major problems since I am new to python I keep trying to do it > as I

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 05.09.2012 18:24, Steven D'Aprano wrote: > On Wed, 05 Sep 2012 16:51:10 +0200, Johannes Bauer wrote: > [...] >>> You are making unjustified assumptions about the distribution of >>> letters in the words. This might be a list of long chemical compounds >>> where the words typically differ only in

Re: ===== Soft Skills Training In Chennai ======

2012-09-06 Thread Ramchandra Apte
On Thursday, 6 September 2012 11:26:21 UTC+5:30, mike pittenson wrote: > Ayus Technologies offers Dot net training in chennai,java/j2ee training in > chennai,SEO training in chennai,web designing training in chennai,soft skills > training in chennai,Software Testing training in chennai. > > >

Re: Language workbench written in python3

2012-09-06 Thread Ramchandra Apte
On Thursday, 6 September 2012 02:34:17 UTC+5:30, Nestor Arocha wrote: > I'm developing a language workbench written in Python. The idea is to create > an environment where grammars and translators can interact easily. > > > > https://github.com/nesaro/pydsl > > > > any comments, feedback or

Re: is implemented with id ?

2012-09-06 Thread Ramchandra Apte
On Thursday, 6 September 2012 17:46:38 UTC+5:30, Roy Smith wrote: > In article <50484643$0$29977$c3e8da3$54964...@news.astraweb.com>, > > Steven D'Aprano wrote: > > > > > On Wed, 05 Sep 2012 14:27:44 -0400, Terry Reedy wrote: > > > > > > > On 9/5/2012 8:48 AM, Ramchandra Apte wrote: > >

Re: Need help fixing this error please:NameError: global name is not defined

2012-09-06 Thread Chris Angelico
On Thu, Sep 6, 2012 at 10:07 PM, shaun wrote: > Hi Chris, > > I'm changing it into multiple classes because the script is going to get > much larger its more for maintainability reasons rather than functionality > reasons. Doesn't necessarily have to be multiple classes. Python gives you t

Re: Setting up a class

2012-09-06 Thread MRAB
On 06/09/2012 13:00, shaun wrote: Hi all, So I'm trying to to OO a script which is currently in place on work. It connects to the database and makes multiple strings and sends them to a server. But I'm having major problems since I am new to python I keep trying to do it as I would do it in J

Re: Comparing strings from the back?

2012-09-06 Thread Chris Angelico
n Thu, Sep 6, 2012 at 10:13 PM, Roy Smith wrote: > In article <50485fca$0$29977$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> In any case, the *worst* case for string equality >> testing is certainly O(N) (every character must be looked at), and the >> *best* case is O(1) ob

Re: is implemented with id ?

2012-09-06 Thread Roy Smith
In article <50484643$0$29977$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 05 Sep 2012 14:27:44 -0400, Terry Reedy wrote: > > > On 9/5/2012 8:48 AM, Ramchandra Apte wrote: > > > > > and "a==True" should be automatically changed into memory comparison. > > > > I have n

Re: Setting up a class

2012-09-06 Thread Joel Goldstick
On Thu, Sep 6, 2012 at 8:00 AM, shaun wrote: > Hi all, > > So I'm trying to to OO a script which is currently in place on work. It > connects to the database and makes multiple strings and sends them to a > server. > > But I'm having major problems since I am new to python I keep trying to do it

Re: Comparing strings from the back?

2012-09-06 Thread Roy Smith
In article <50485fca$0$29977$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > In any case, the *worst* case for string equality > testing is certainly O(N) (every character must be looked at), and the > *best* case is O(1) obviously (the first character fails to match). The best

Re: Need help fixing this error please:NameError: global name is not defined

2012-09-06 Thread shaun
Hi Chris, I'm changing it into multiple classes because the script is going to get much larger its more for maintainability reasons rather than functionality reasons. Thanks so much man it was the "self" fix you stated above. I woe you a pint of Guinness :D Thanks again, Shaun -- http:/

Re: Need help fixing this error please:NameError: global name is not defined

2012-09-06 Thread MRAB
On 06/09/2012 12:37, shaun wrote: Sorry guys here is the full code for the class: #!/usr/bin/python # Echo client program import cx_Oracle import socket import pprint from struct import * import sys from binascii import * Don't use "from something import *". It'll import a whole load of names.

Setting up a class

2012-09-06 Thread shaun
Hi all, So I'm trying to to OO a script which is currently in place on work. It connects to the database and makes multiple strings and sends them to a server. But I'm having major problems since I am new to python I keep trying to do it as I would do it in Java but classes seem to be very diff

Re: Need help fixing this error please:NameError: global name is not defined

2012-09-06 Thread Chris Angelico
On Thu, Sep 6, 2012 at 9:37 PM, shaun wrote: > class StringCall: > results=[] > def databasebatchcall(self,termid, batchid): > con = > cx_Oracle.connect('user/user...@odb4.dcc.company.ie/ODB4TEST.COMPANY.IE') > cur = con.cursor() > c

  1   2   >