Re: Probability Algorithm

2012-08-25 Thread Dave Angel
On 08/25/2012 12:03 PM, 月忧茗 wrote: > Hi, All, > > I have a problem of probability algorithm > > > The goal is obtain a list which contains three items. as the *FinalList* > > There has Four source lists. * > ALIST, BLIST, CLIST, DLIST > > There are all Unknown length. They contains unique elem

Re: popen4 - get exit status

2012-08-27 Thread Dave Angel
On 08/27/2012 06:39 PM, Tim Johnson wrote: > In bash I do the following: > linus:journal tim$ /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl hiccup > -bash: /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl: No such file or > directory > linus:journal tim$ echo $? > 127 > > In python, use os.pope

Re: Are the property Function really useful? yes.

2012-08-29 Thread Dave Angel
On 08/29/2012 06:32 AM, levinie...@gmail.com wrote: -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Flexible string representation, unicode, typography, ...

2012-08-29 Thread Dave Angel
On 08/29/2012 07:40 AM, wxjmfa...@gmail.com wrote: > > Forget Python and all these benchmarks. The problem is on an other > level. Coding schemes, typography, usage of characters, ... For a > given coding scheme, all code points/characters are equivalent. > Expecting to handle a sub-range in a co

Re: Are the property Function really useful? yes.

2012-08-30 Thread Dave Angel
On 08/29/2012 07:46 AM, Dave Angel wrote: > On 08/29/2012 06:32 AM, levinie...@gmail.com wrote: > > I was trying to point out that your question was empty (no content in the message). Mark also apparently saw an empty message. However, now that Dieter has responded, with apparent qu

Re: class object's attribute is also the instance's attribute?

2012-08-30 Thread Dave Angel
On 08/30/2012 06:55 AM, 陈伟 wrote: > when i write code like this: > > class A(object): > > d = 'it is a doc.' > > > t = A() > > print t.__class__.d > print t.d > > the output is same. > > so it means class object's attribute is also the instance's attribute. is it > right? i can not

Re: Beginners question

2012-08-30 Thread Dave Angel
On 08/30/2012 07:54 AM, boltar2003@boltar.world wrote: > Hello > > I'm slowly teaching myself python so apologies if this is a dumb question. > but something has confused me with the os.stat() function: > s = os.stat(".") print s > posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=

Re: Beginners question

2012-08-30 Thread Dave Angel
On 08/30/2012 08:50 AM, boltar2003@boltar.world wrote: > On Thu, 30 Aug 2012 13:14:57 +0100 > MRAB wrote: > > If its a class , why is it when I create my own class I get a completely > different output with print and type? > class foo(object): > .. def __init__(self): > .. pa

Re: class object's attribute is also the instance's attribute?

2012-08-30 Thread Dave Angel
On 08/30/2012 10:11 AM, Marco Nawijn wrote: > On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote: >> >> > Learned my lesson today. Don't assume you know something. Test it first ;). I > have done quite some programming in Python, but did not know that class > attributes are still l

Re: class object's attribute is also the instance's attribute?

2012-08-30 Thread Dave Angel
On 08/30/2012 10:48 AM, Marco Nawijn wrote: > On Thursday, August 30, 2012 4:30:59 PM UTC+2, Dave Angel wrote: >> On 08/30/2012 10:11 AM, Marco Nawijn wrote: >> >>> On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote: >> >>>> >> >&

Re: XML parser: Element ordering?

2012-08-31 Thread Dave Angel
On 08/31/2012 08:21 AM, Stefan Behnel wrote: > Florian Lindner, 31.08.2012 14:03: >> I plan to use the etree.ElementTree XML parser to parse a config file >> in which the order of the elements matter, e.g.: >> >> >> >> >> >> is not equal to: >> >> >> >> >> >> I have found different answers to

Re: to know binary

2012-08-31 Thread Dave Angel
On 09/01/2012 12:15 AM, contro opinion wrote: > there is a only line in the file nanmed test: > 1234 > when i open it whit xxd > xxd test > what i get is : > 000: 3132 3334 0a 1234. > can you explain it ? > > > Explain what, exactly? Explain why you were able to

Re: to know binary

2012-08-31 Thread Dave Angel
On 09/01/2012 12:59 AM, contro opinion wrote: 1) you top-posted 2) you replied privately, excluding the list from your query > the file is utf-8 format, str='/0x31/0x32/0x33/0x34' 3) No idea what that value is supposed to mean. Perhaps you intended to use backslashes here? And perhaps you

Re: The method of insert doesn't work with nltk texts: AttributeError: 'ConcatenatedCorpusView' object has no attribute 'insert'

2012-09-02 Thread Dave Angel
On 09/02/2012 05:39 AM, Token Type wrote: > I wrote codes to add 'like' at the end of every 3 word in a nltk text as > follows: > text = nltk.corpus.brown.words(categories = 'news') def hedge(text): > for i in range(3,len(text),4): > new_text = text.insert(i, 'like')

Re: Fwd: The method of insert doesn't work with nltk texts: AttributeError: 'ConcatenatedCorpusView' object has no attribute 'insert'

2012-09-02 Thread Dave Angel
On 09/02/2012 09:06 AM, John H. Li wrote: > First, thanks very much for your kind help. > > 1)Further more, I test the function of insert. It did work as follows: > text = ['The', 'Fulton', 'County', 'Grand'] text.insert(3,'like') text > ['The', 'Fulton', 'County', 'like', 'Grand'] >

Re: newbie ``print`` question

2012-09-02 Thread Dave Angel
On 09/02/2012 03:34 PM, gwhite wrote: > > > btw, I also thought the default "add a CR LF" to the end was odd too. > But at least that one had a simple way out. But it (print on Python 2.x) doesn't, unless you're stuck on Windows. And even then, you can prevent it by using a 'b' in the mode. --

Re: stuck in files!!

2012-09-02 Thread Dave Angel
On 09/02/2012 03:36 PM, me wrote: > The best you can do is pipe a string to a .txt document then pipe it again to > a wordpad document. You should be able to do that easily with file and open() > If your reply is going to break the thread, and if the thread has been stale almost a month, then it

Re: Flexible string representation, unicode, typography, ...

2012-09-02 Thread Dave Angel
On 09/02/2012 03:45 PM, Michael Torrie wrote: > : > In the worst case, Python's strings are as slow as Go because Python > does the exact same thing as Go, but chooses between three encodings > instead of just one. Best case scenario, Python's strings could be > much faster than Go's because indexi

Re: newbie ``print`` question

2012-09-02 Thread Dave Angel
On 09/02/2012 03:50 PM, gwhite wrote: > On Sep 2, 12:43 pm, Dave Angel wrote: >> On 09/02/2012 03:34 PM, gwhite wrote: >> >>> >>> btw, I also thought the default "add a CR LF" to the end was odd too. >>> But at least that one had a simple way

Re: stuck in files!!

2012-09-02 Thread Dave Angel
On 09/02/2012 04:07 PM, me wrote: > Didn't see the post date on my reader haha. Sorry about that. > Well, i see you're also posting responses to recent messages. Great. But please use reply with a proper mail program; your messages are all brand new threads. And could you fix your email address

Re: The opener parameter of Python 3 open() built-in

2012-09-03 Thread Dave Angel
On 09/03/2012 08:32 AM, Marco wrote: > Does anyone have an example of utilisation? As of Python 3.2.3, there is no "opener" parameter in the open() function. http://docs.python.org/py3k/library/functions.html I don't know of any such parameter in earlier or later versions, but I could be wron

Re: set and dict iteration

2012-09-03 Thread Dave Angel
On 09/03/2012 04:04 PM, Aaron Brady wrote: > On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote: >> On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady wrote: >> >>> We could use a Python long object for the version index to prevent >>> overflow. Combined with P. Rubin's idea to count the number

Re: set and dict iteration

2012-09-03 Thread Dave Angel
On 09/03/2012 09:26 PM, Steven D'Aprano wrote: > On Mon, 03 Sep 2012 13:04:23 -0700, Aaron Brady wrote: > >> >> >> I think the technique would require two python longs and a bool in the >> set, and a python long in the iterator. >> >> One long counts the number of existing (open) iterators. Anoth

Re: Beginners question

2012-09-05 Thread Dave Angel
On 09/05/2012 04:03 AM, Mark Lawrence wrote: > On 05/09/2012 07:28, charvigro...@gmail.com wrote: >> Hi, >> >> I have attached python interview questions and answers for beginners. >> >> Please visit http://www.f2finterview.com/web/CorePython/ for core >> python and >> >> http://www.f2finterview.co

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 08:48 AM, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 14:44:23 UTC+5:30, Steven D'Aprano wrote: >> >> > Seeing this thread, I think the is statment should be removed. > It has a replacement syntax of id(x) == id(y) and "a==True" should be > automatically changed into m

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
Please don't top-post. Now your message is out of order, and if I have to delete the part Benjamin said. On 09/05/2012 09:19 AM, Franck Ditter wrote: > Thanks to all, but : > - I should have said that I work with Python 3. Does that matter ? > - May I reformulate the queston : "a is b" and "id(a)

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 10:41 AM, Steven D'Aprano wrote: > On Wed, 05 Sep 2012 10:00:09 -0400, Dave Angel wrote: > >> On 09/05/2012 09:19 AM, Franck Ditter wrote: >>> Thanks to all, but : >>> - I should have said that I work with Python 3. Does that matter ? - >>

Re: Python Interview Questions

2012-09-05 Thread Dave Angel
On 09/05/2012 11:34 AM, Chris Angelico wrote: > On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly wrote: >> The lack of an ORDER BY is the least of the problems with that SQL. >> He's also using LIMIT without OFFSET, so the only thing that the >> 'item' argument changes is how many rows are returned (all

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 12:47 PM, Hans Mulder wrote: > On 5/09/12 17:09:30, Dave Angel wrote: >> But by claiming that id() really means address, and that those addresses >> might move during the lifetime of an object, then the fact that the id() >> functions are not called simultaneo

Re: python docs search for 'print'

2012-09-05 Thread Dave Angel
On 09/05/2012 01:47 PM, Grant Edwards wrote: > On 2012-09-05, Terry Reedy wrote: >> On 9/4/2012 11:22 PM, Ramchandra Apte wrote: >> >>> I was actually planning to write a bug on this. >> If you do, find the right place to submit it. >> bugs.python.org is for issues relating to the cpython reposito

Re: is implemented with id ?

2012-09-05 Thread Dave Angel
On 09/05/2012 02:27 PM, Terry Reedy wrote: > On 9/5/2012 8:48 AM, Ramchandra Apte wrote: > >> Seeing this thread, I think the is statment should be removed. >> It has a replacement syntax of id(x) == id(y) > > The thread is wrong then. > > If the implementation reuses ids, which CPython does, > is

Re: Comparing strings from the back?

2012-09-06 Thread Dave Angel
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 textbook, but I can't > find that reference now, so possibly

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

2012-09-06 Thread Dave Angel
On 09/06/2012 06:45 AM, shaun wrote: > Hi all, > > I have a class which I create an object from in a different script but when > its run I get an error at the last part of this method: > > CODE/// > > def databasebatchcall(self,tid, bid): > > con=cx_Oracle

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: 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: 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

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 com

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 l

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: 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: 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: 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 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 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: 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: 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

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: 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

Re: How to print something only if it exists?

2012-09-08 Thread Dave Angel
On 09/08/2012 06:02 AM, tinn...@isbd.co.uk wrote: > Dave Angel wrote: >> Would you like to define "exists" ? A list is not sparse, so all items >> exist if their subscript is less than the length of the list. So all >> you need to do is compare 2 to len(fld). >

Re: Looking for download link for ArcPY

2012-09-08 Thread Dave Angel
On 09/08/2012 03:19 PM, David Shi wrote: > Hi, All, > > Can anyone send me the link for downloading ArcPY? > > I came across it before, but can not find it anymore. > > Regards. > > David > Try this link; it looks promising. http://www.arcgis.com/home/item.html?id=3a790cd717514f4689ae197c7920580

Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Dave Angel
See the identical thread you posted on tutor, where it was a better match. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner Q: What does the double underscore __ mean?

2012-09-09 Thread Dave Angel
On 09/09/2012 12:04 PM, hamilton wrote: > On 9/9/2012 6:39 AM, Dave Angel wrote: >> See the identical thread you posted on tutor, where it was a better >> match. >> >> >> > Would you please post that link for those of us that did not see that > one. > &

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-09-11 Thread Dave Angel
On 09/11/2012 03:13 PM, ruck wrote: > > > I'm not sure how I could have known that ntpath was already imported, since > *I* didn't import it, but that was the key to my confusion. > import sys print sys.modules -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: using subprocess.Popen does not suppress terminal window on Windows

2012-09-12 Thread Dave Angel
On 09/12/2012 11:26 AM, janis.judvai...@gmail.com wrote: > Hi, and I'm sorry for using this old thread, but I'm experiencing the same > problem, except, that I wan't to execute any shell script or exe without > blank terminal window. > Is there any way in python to supress blank console screen w

Re: avoid the redefinition of a function

2012-09-12 Thread Dave Angel
On 09/12/2012 12:56 PM, Jabba Laci wrote: > Thanks for the answers. I decided to use numbers in the name of the > functions to facilitate function calls. Now if you have this menu > option for instance: > > (5) install mc > > You can type just "5" as user input and step_5() is called > automaticall

Re: datetime issue

2012-09-16 Thread Dave Angel
On 09/16/2012 07:56 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 16 Σεπτεμβρίου 2012 2:34:34 μ.μ. UTC+3, ο χρήστης Steven D'Aprano > έγραψε: >> >> >> No. That's not how mailing lists work. Every email gets posted to all >> members, unless they go onto "No Mail", in which case they get no emails >>

Re: Python garbage collector/memory manager behaving strangely

2012-09-16 Thread Dave Angel
On 09/16/2012 09:07 PM, Jadhav, Alok wrote: > Hi Everyone, > > > > I have a simple program which reads a large file containing few million > rows, parses each row (`numpy array`) and converts into an array of > doubles (`python array`) and later writes into an `hdf5 file`. I repeat > this loop fo

Re: Python garbage collector/memory manager behaving strangely

2012-09-17 Thread Dave Angel
On 09/16/2012 11:25 PM, alex23 wrote: > On Sep 17, 12:32 pm, "Jadhav, Alok" > wrote: >> - As you have seen, the line separator is not '\n' but its '|\n'. >> Sometimes the data itself has '\n' characters in the middle of the line >> and only way to find true end of the line is that previous charact

Re: Python garbage collector/memory manager behaving strangely

2012-09-17 Thread Dave Angel
On 09/17/2012 07:47 AM, Steven D'Aprano wrote: > On Mon, 17 Sep 2012 06:46:55 -0400, Dave Angel wrote: > >> On 09/16/2012 11:25 PM, alex23 wrote: >>> def readlines(f): >>> lines = [] >>> while "f is not empty": >>&

Re: how to use property?

2012-09-17 Thread Dave Angel
On 09/17/2012 05:55 PM, Fernando Jiménez wrote: > Hi guys! > > I'm noob in python and I would know how to correctly use the property. I > have read some things about it but I do not quite understand. > > I found this: > > class C(object): > def __init__(self): > self._x = None > > @

Re: how to use property?

2012-09-17 Thread Dave Angel
On 09/17/2012 07:34 PM, Terry Reedy wrote: > On 9/17/2012 6:12 PM, Chris Angelico wrote: >> On Tue, Sep 18, 2012 at 7:55 AM, Fernando Jiménez >> wrote: >>> Hi guys! >>> >>> I'm noob in python and I would know how to correctly use the >>> property. I >>> have read some things about it but I do not

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Dave Angel
On 09/17/2012 09:08 PM, David Smith wrote: > Hello, I'm essentially a newbie in Python. > My problem in searching the archives is not knowing what words to use > to ask. > > I'm converting windows bat files little by little to Python 3 as I > find time and learn Python. > The most efficient method

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Dave Angel
On 09/18/2012 01:08 AM, Terry Reedy wrote: > On 9/17/2012 9:08 PM, David Smith wrote: >> Hello, I'm essentially a newbie in Python. >> My problem in searching the archives is not knowing what words to use to >> ask. >> >> I'm converting windows bat files little by little to Python 3 as I find >> ti

Re: Fwd: Programming Issues

2012-09-18 Thread Dave Angel
On 09/18/2012 08:47 PM, Nathan Spicer wrote: > -- Forwarded message -- > From: Nathan Spicer > Date: Tue, Sep 18, 2012 at 8:32 PM > Subject: Programming Issues > To: webmas...@python.org > > > Hello, > > My name is Nathan Spicer. I'm taking a computer programming class using > pyth

Re: Using dict as object

2012-09-19 Thread Dave Angel
On 09/19/2012 06:24 AM, Pierre Tardy wrote: > One thing that is cooler with java-script than in python is that dictionaries > and objects are the same thing. It allows browsing of complex hierarchical > data syntactically easy. You probably need some different terminology, since a dictionary is

Re: using text file to get ip address from hostname

2012-09-19 Thread Dave Angel
On 09/19/2012 08:28 AM, Dan Katorza wrote: > בתאריך יום רביעי, 19 בספטמבר 2012 12:11:04 UTC+3, מאת Dan Katorza: >> >> hi, ll like >> found a solution, >> it's not quite like Chris advised but it works. Not at all like Chris advised. But it also doesn't help you understand programming. Two conce

Re: Programming Issues

2012-09-20 Thread Dave Angel
On 09/19/2012 07:01 PM, Nathan Spicer wrote: > Dave, > You sent this response privately, which isn't the way the mailing list works. Private responses are good for thank-yous and for personal remarks of no interest to others. But you're short-circuiting the helping process

Re: portable way of locating an executable (like which)

2012-09-20 Thread Dave Angel
On 09/20/2012 06:04 PM, Jason Swails wrote: > On Thu, Sep 20, 2012 at 5:06 PM, Gelonida N wrote: > >> I'd like to implement the equivalent functionality of the unix command >> /usr/bin/which >> >> The function should work under Linux and under windows. >> >> Did anybody already implement such a fu

Re: how to do draw pattern with python?

2012-09-21 Thread Dave Angel
On 09/21/2012 09:36 AM, echo.hp...@gmail.com wrote: > may i know how to shift the bits using only looping and branching?? Yes, show us your code, and what isn't working, and we'll try to help you complete the assignment. It'd probably also be good to specify the rest of the homework, like what ve

Re: Does python have built command for package skeleton creation?

2012-09-21 Thread Dave Angel
On 09/21/2012 11:54 AM, Steven D'Aprano wrote: > On Fri, 21 Sep 2012 14:50:36 +0100, Mark Lawrence wrote: > >> On 21/09/2012 14:13, xliiv wrote: >>> Why is this '2 years release cycle'? >>> >>> >> Because there aren't enough volunteers to get it done any faster? > Because if it were any faster, it

Re: Blue Screen Python

2012-09-21 Thread Dave Angel
On 09/21/2012 12:01 PM, Alister wrote: > On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: > >> On 2012-09-21, mikcec82 wrote: >>> Hallo to all, >>> >>> I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 >>> -2350M CPU @2.30GHz 2.3GHz. >>> >>> Sometimes, when I'm programmin

Re: Blue Screen Python

2012-09-22 Thread Dave Angel
On 09/22/2012 06:53 AM, Alister wrote: > On Fri, 21 Sep 2012 18:47:57 -0400, Dave Angel wrote: > >> >> >> That's not true at all. You'd re thinking of Windows 3, Windows 95, 98, >> and ME, which were hacked on top of MSDOS. But Windows NT3.5, 4, 2000, >

Re: Exact integer-valued floats

2012-09-22 Thread Dave Angel
On 09/22/2012 05:05 PM, Tim Roberts wrote: > Dennis Lee Bieber wrote: >> On 22 Sep 2012 01:36:59 GMT, Steven D'Aprano wrote: >>> For non IEEE 754 floating point systems, there is no telling how bad the >>> implementation could be :( >> Let's see what can be found... >> >> IBM 360: Same

Re: List Problem

2012-09-23 Thread Dave Angel
On 09/23/2012 05:44 PM, jimbo1qaz wrote: > On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: >> I have a nested list. Whenever I make a copy of the list, changes in one >> affect the other, even when I use list(orig) or even copy the sublists one >> by one. I have to manually copy

Re: python file API

2012-09-24 Thread Dave Angel
On 09/24/2012 05:35 PM, zipher wrote: > For some time now, I've wanted to suggest a better abstraction for the > type in Python. It currently uses an antiquated C-style interface for moving > around in a file, with methods like tell() and seek(). But after attributes > were introduced to Pyth

Re: python file API

2012-09-24 Thread Dave Angel
(forwarding to the list) On 09/24/2012 06:23 PM, Mark Adam wrote: > On Mon, Sep 24, 2012 at 4:49 PM, Dave Angel wrote: >> On 09/24/2012 05:35 PM, zipher wrote: >>> For some time now, I've wanted to suggest a better abstraction for the >>> type in Python. I

Re: Memory usage per top 10x usage per heapy

2012-09-24 Thread Dave Angel
On 09/24/2012 05:59 PM, MrsEntity wrote: > Hi all, > > I'm working on some code that parses a 500kb, 2M line file Just curious; which is it, two million lines, or half a million bytes? > line by line and saves, per line, some derived strings into various data > structures. I thus expect that m

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Dave Angel
On 09/25/2012 12:21 AM, Junkshops wrote: >> Just curious; which is it, two million lines, or half a million bytes? > > Sorry, that should've been a 500Mb, 2M line file. > >> which machine is 2gb, the Windows machine, or the VM? > VM. Winders is 4gb. > >> ...but I would point out that just beca

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Dave Angel
front of the quoted portions. This next section is by me, but you don't say so. That's because you copy/pasted it from elsewhere in the reply, and didn't copy the "... Dave Angel wrote" part. Much easier is to take the reply, and remove the parts you're not going to re

Re: FirePlus

2012-09-26 Thread Dave Angel
On 09/26/2012 08:31 PM, alex23 wrote: > On Sep 27, 5:19 am, php...@gmail.com wrote: >> http://bin.x.yyy/p.zip >> >> by WatchMan > Context? Description? Virus propagation? Why would you propagate that link? When I saw the original, I just deleted it immediately from the local folder.

Re: [Python-Dev] [RELEASED] Python 3.3.0

2012-09-29 Thread Dave Angel
On 09/29/2012 08:23 AM, Amit Saha wrote: > On Sat, Sep 29, 2012 at 10:18 PM, Georg Brandl wrote: >> >> >> For a more extensive list of changes in 3.3.0, see >> >> http://docs.python.org/3.3/whatsnew/3.3.html > Redirects to http://docs.python.org/py3k/whatsnew/3.3.html: 404 Not Found. > > Wor

Re: unexpected error from Python 3.3.0

2012-09-29 Thread Dave Angel
On 09/29/2012 10:19 AM, Alexis Lopez-Garcia wrote: > Hi. > > I installed Python3.3.0 with python-3.3.0.amd64.msi on a win7 machine. > > While using this funcion (see below) from a script called by double > clicking on the .py file I get a "invalid variable "right" referenced > before assignment" er

Re: Compairing filenames in a list

2012-09-29 Thread Dave Angel
On 09/29/2012 09:27 PM, Kevin Anthony wrote: > I have a list of filenames, and i need to find files with the same > name, different extensions, and split that into tuples. does anyone have > any suggestions on an easy way to do this that isn't O(n^2)? > > Sure, collect them in a collections.defau

Re: parse an environment file

2012-09-30 Thread Dave Angel
On 09/30/2012 08:11 PM, Jason Friedman wrote: First comment: I don't know anything about an "environment file." An environment is an attribute of a process, and it's inherited by subprocesses that process launches. This is not a Python thing, it's an OS thing, for whatever OS you're running. >

Re: Can't import modules

2012-09-30 Thread Dave Angel
On 09/30/2012 08:35 PM, Peter Farrell wrote: You top-posted, which means there's no context; the message is now out of order. Please put your responses after the parts you're quoting, or don't bother quoting. > Thanks for trying to help, everybody. Sorry I didn't post the whole error > message

Re: Can't import modules

2012-09-30 Thread Dave Angel
On 09/30/2012 09:35 PM, Peter Farrell wrote: > On Sunday, September 30, 2012 6:25:29 PM UTC-7, Steven D'Aprano wrote: >> On Sun, 30 Sep 2012 17:35:02 -0700, Peter Farrell wrote: >> >> >> >>> Thanks for trying to help, everybody. Sorry I didn't post the whole >>> error message. Now my problem is I j

Re: Coexistence of Python 2.x and 3.x on same OS

2012-09-30 Thread Dave Angel
On 09/30/2012 11:06 PM, Edward Diener wrote: > On 9/30/2012 3:38 PM, Andrew Berg wrote: >> On 2012.09.30 14:14, Edward Diener wrote: >>> The situation is so confusing on Windows, where the file associations, >>> registry entries, and other internal software which allows a given >>> Python release t

Re: Download issue.

2012-10-02 Thread Dave Angel
On 10/02/2012 04:43 AM, subhabangal...@gmail.com wrote: > Dear Group, > > I am using Python on Windows 7 SP-1 (64 bit). > > I have two versions of Python installed 2.7 and 3.2. > > I want to install networkx in both. > > How may I do that? > > If any one may kindly let me know. > Doing a search fo

Re: local variable 'a' referenced b

2012-10-02 Thread Dave Angel
On 10/02/2012 10:03 PM, contro opinion wrote: > code1 def foo(): > ... a = 1 > ... def bar(): > ... b=2 > ... print a + b > ... bar() > ... > ... foo() > 3 > > code2 def foo(): > ... a = 1 > ... def bar(): > ... b=2 > ... a = a + b

Re: local variable 'a' referenced b

2012-10-02 Thread Dave Angel
On 10/03/2012 01:54 AM, Demian Brecht wrote: > On 12-10-02 07:26 PM, Dave Angel wrote: >> >> if you're stuck with Python2.x, you can use a mutable object for a, and >> mutate it, rather than replace it. For example, >> >> >> def foo(): >>

Re: sum function

2012-10-04 Thread Dave Angel
On 10/04/2012 05:29 PM, Mike wrote: > I get below error > > NameError: name 'functools' is not defined > functools is a module in the standard library. You need to import it. import functools -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: error bluetooth

2012-10-05 Thread Dave Angel
On 10/05/2012 04:51 AM, Luca Sanna wrote: > the code is output the error of the ubuntu > > from bluetooth import * > > target_name = "My Phone" > target_address = None > > nearby_devices = discover_devices() > > for address in nearby_devices: > if target_name == lookup_name( address ): >

Re: sum function

2012-10-05 Thread Dave Angel
On 10/05/2012 04:09 PM, Mike wrote: > Terry, > > I am not using the mail client. I am just posting on the site. And which site would that be (that you're using)? There are a few. I'm guessing you use google-groups. And all of them get gatewayed to the actual list, with differing numbers of bugs

Re: try/except KeyError vs "if name in ..."

2012-10-06 Thread Dave Angel
On 10/06/2012 02:27 AM, Manuel Pégourié-Gonnard wrote: > Hi, > > I was looking at the example found here [1] which begins with: > > [1] http://docs.python.org/py3k/library/imp.html#examples > > def __import__(name, globals=None, locals=None, fromlist=None): > # Fast path: see if the module has

Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ?

2012-10-08 Thread Dave Angel
On 10/08/2012 10:07 AM, iMath wrote: > To get the accurate value of 1 - 0.999 ,how to implement the > python algorithm ? > BTW ,Windows’s calculator get the accurate value ,anyone who knows how to > implement it ? Windows calculator is an application, not a programming language. Lik

Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ?

2012-10-08 Thread Dave Angel
On 10/08/2012 11:00 AM, Chris Angelico wrote: > On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote: >> import decimal >> a = decimal.Decimal(4.3) >> print(a) >> >> 5.0996447286321199499070644378662109375 > Ah, the delights of copy-paste :) > &g

Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ?

2012-10-08 Thread Dave Angel
On 10/08/2012 09:45 PM, Terry Reedy wrote: > On 10/8/2012 11:13 AM, Dave Angel wrote: > >>> Isn't it true, though, that Python 3.3 has a completely new >>> implementation of decimal that largely removes this disadvantage? > >> I wouldn't know, I'm on

Re: Unpaking Tuple

2012-10-08 Thread Dave Angel
On 10/09/2012 02:07 AM, Bob Martin wrote: > in 682592 20121008 232126 "Prasad, Ramit" wrote: >> Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at = >> 03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_= >> tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if

Re: string contains and special characters

2012-10-09 Thread Dave Angel
On 10/09/2012 10:02 AM, loial wrote: > I am trying to match a string that containing the "<" and ">" characters, > using the string contains function, but it never seems to find the lines > containing the string > > e.g if mystring.contains("") : > > Do I need to escape the characters...and if so

<    1   2   3   4   5   6   7   8   9   10   >