Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread Dave Angel
On 04/16/2012 12:30 AM, vmars316 wrote: > Greetings, > windows7, portablePython3.2: > What if i wanted to send myProg.py to a friend to RUN (who has python > installed). > Isn't there a way just to doubleClick on myProg.py, to get it into the > interpret/RUN? > Could i RUN a myProg.o ? > There must

Re: sort by column a csv file case insensitive

2012-04-15 Thread Dave Angel
On 04/16/2012 01:11 AM, Lee Chaplin wrote: > Hi all, > > I am trying to sort, in place, by column, a csv file AND sort it case > insensitive. > I was trying something like this, with no success: Could you perhaps qualify that "no success" bit? Do you mean it didn't output a file, or that the file

Re: how to count the total number of strings (in the list) used in Python?

2012-04-16 Thread Dave Angel
Did you have a reason to spam us with a second copy of the message after only 3 minutes? Usually, you should wait a few days, and then REPLY to the earlier one, don't leave another with the same subject. The way you did it, some people might respond to one, and some to the other, creating two sep

Re: Different results for different versions of urllib2

2012-04-20 Thread Dave Angel
On 04/20/2012 06:47 PM, Diego Manenti Martins wrote: > Hi. > Anybody knows the data is sent in a different way for Python 2.5, 2.6 > and 2.7 using this code: > import urllib2 url = 'http://server.com/post_image?tid=zoV6LJ' f = open('test.jpg') data = f.read() res = urllib2.

Fwd: Re: Different results for different versions of urllib2

2012-04-20 Thread Dave Angel
You forgot to include the list in your response. I don't normally respond to private messages, but I'll make an exception. On Fri, Apr 20, 2012 at 10:08 PM, Dave Angel wrote: > On 04/20/2012 06:47 PM, Diego Manenti Martins wrote: >> Hi. >> Anybody knows the data is se

Re: Unable to Concatenate a file - destination kept getting overwritten

2012-04-20 Thread Dave Angel
On 04/20/2012 09:03 PM, Foster Rilindo wrote: > I can't seem to concatenate. > > I got binary files here: > > yvaine:disk rilindo$ ls -lah > total 61440 > drwxr-xr-x 4 rilindo staff 136B Apr 20 19:47 . > drwxr-xr-x 10 rilindo staff 340B Apr 20 19:45 .. > -rw-r--r-- 1 rilindo staff20

Re: Different results for different versions of urllib2

2012-04-20 Thread Dave Angel
On 04/20/2012 11:06 PM, Diego Manenti Martins wrote: > On Fri, Apr 20, 2012 at 11:09 PM, Dave Angel wrote: >> You forgot to include the list in your response. I don't normally >> respond to private messages, but I'll make an exception. > Sorry about that and thanks.

Re: why () is () and [] is [] work in other way?

2012-04-20 Thread Dave Angel
On 04/20/2012 11:25 PM, Rotwang wrote: > On 21/04/2012 01:01, Roy Smith wrote: >> In article<877gxajit0@dpt-info.u-strasbg.fr>, >> Alain Ketterlin wrote: >> >>> Tuples are immutable, while lists are not. >> >> If you really want to have fun, consider this classic paradox: >> > [] is [] >

Re: some beginners questions about programming

2012-04-21 Thread Dave Angel
On 04/21/2012 06:03 AM, Santosh Kumar wrote: > Hello Python Developers, > > I have a very less experience with programming. I have digged a little bit > of all (I mean *C, **Java, JavaScript, PHP*) at introductory level and now > I have two question about it. > >1. Are *Arrays* and *Lists* same

Re: Appending to []

2012-04-21 Thread Dave Angel
On 04/21/2012 08:48 AM, Bernd Nawothnig wrote: > On 2012-04-20, Rotwang wrote: >> since a method doesn't assign the value it returns to the instance on >> which it is called; what it does to the instance and what it returns are >> two completely different things. > Returning a None-value is prett

Re: why () is () and [] is [] work in other way?

2012-04-21 Thread Dave Angel
On 04/21/2012 09:02 AM, Bernd Nawothnig wrote: > On 2012-04-20, dmitrey wrote: >> I have spent some time searching for a bug in my code, it was due to >> different work of "is" with () and []: > () is () >> True > You should better not rely on that result. I would consider it to be > an impleme

Re: why () is () and [] is [] work in other way?

2012-04-21 Thread Dave Angel
On 04/21/2012 09:48 AM, Bernd Nawothnig wrote: > On Sat, Apr 21, 2012 at 09:21:50AM -0400, Dave Angel wrote: >>>>>>> [] is [] >>>> False >>> Same for that. >> >> Here I have to disagree. If an implementation reused the list object >&

Re: global vars across modules

2012-04-22 Thread Dave Angel
On 04/22/2012 05:08 PM, Kiuhnm wrote: > On 4/22/2012 21:39, mambokn...@gmail.com wrote: >> I need to use global var across files/modules: >> >> # file_1.py >> a = 0 >> def funct_1() : >> a = 1# a is global >> print(a) >> >> >> # file_2.py >> from file_1 import * >> def main() : >>

Re: why () is () and [] is [] work in other way?

2012-04-22 Thread Dave Angel
On 04/23/2012 12:42 AM, Devin Jeanpierre wrote: > On Mon, Apr 23, 2012 at 12:34 AM, Steven D'Aprano > wrote: >> On Sun, 22 Apr 2012 12:43:36 -0700, John Nagle wrote: >> >>> On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote: On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote: >>>

Re: Set Date and Time on Python

2012-04-26 Thread Dave Angel
On 04/26/2012 03:09 AM, viral shah wrote: > Hi > > I'm very new to Python programming. > > Please help me to add date and time ! > > Following is the code done by me. > > import datetime > class Module > type(datetime.datetime) > > Now what's the next to do for displaying date and time ? > You

Re: set PYTHONPATH for a directory?

2012-05-04 Thread Dave Angel
On 05/04/2012 08:21 AM, Neal Becker wrote: > I'm testing some software I'm building against an alternative version of a > library. So I have an alternative library in directory L. Then I have in an > unrelated directory, the test software, which I need to use the library > version > from dire

Re: Real time event accuracy

2012-05-09 Thread Dave Angel
On 05/09/2012 11:52 AM, Tobiah wrote: > I'd like to send MIDI events from python to another > program. I'd like advice as to how to accurately > time the events. I'll have a list of floating point > start times in seconds for the events, and I'd like to send them > off as close to the correct tim

Re: tee-like behavior in Python

2012-05-09 Thread Dave Angel
On 05/09/2012 11:35 AM, Florian Lindner wrote: > Hello, > > how can I achieve a behavior like tee in Python? > > * execute an application > * leave the output to stdout and stderr untouched > * but capture both and save it to a file (resp. file-like object) > > I have this code > > proc = subproces

Re: How do I find out what file an import is using?

2012-05-09 Thread Dave Angel
On 05/09/2012 01:52 PM, Rob Richardson wrote: > I am trying to work with a Python script someone else wrote. The script > includes the line > from Level3Utils import * > > I need to look at the functions that are included in that import. In an > effort to identify exactly which file is be

Re: Real time event accuracy

2012-05-09 Thread Dave Angel
On 05/09/2012 03:26 PM, Tobiah wrote: >> I don't think you can really do this accurately enough to get good >> sound, but the basic mechanism is time.sleep(t) which takes a floating >> point argument. That turns into the appropriate microsleep, I think. > I think the time would have to come from a

Re: parallel programming in Python

2012-05-10 Thread Dave Angel
On 05/10/2012 08:14 AM, Jabba Laci wrote: > Hi, > > I would like to do some parallel programming with Python but I don't > know how to start. There are several ways to go but I don't know what > the differences are between them: threads, multiprocessing, gevent, > etc. > > I want to use a single ma

Re: Dealing with the __str__ method in classes with lots of attributes

2012-05-11 Thread Dave Angel
On 05/11/2012 07:16 AM, Andreas Tawn wrote: >> >> This is a very interesting solution. >> >> I think it might be better suited (for my purpose) to __repr__ rather than >> __str__, mostly because I still lose control of the order the attributes >> appear. I have no idea why using __repr__ versus

Re: Opening a csv file in python on a mac

2012-05-12 Thread Dave Angel
On 05/12/2012 06:50 PM, Brian Heese wrote: > I created a csv file called python test file.csv. It is stored on my Desktop > directory. When I try to open it using the command open ('Desktop python > test file.csv') I get the following error: "No such file or directory". The > same thing happens

Re: Hashability questions

2012-05-14 Thread Dave Angel
On 05/14/2012 07:38 PM, Chris Kaynor wrote: > On Sun, May 13, 2012 at 12:11 PM, Bob Grommes wrote: >> >> >> The rule is that, if two objects return different results from >> __hash__, they should never compare equal. The opposite rule also >> holds true: if two objects compare equal, they should

Re: ucs2 and ucs4 python

2012-05-16 Thread Dave Angel
On 05/16/2012 05:20 AM, zayatzz wrote: > On May 16, 11:50 am, Matej Cepl wrote: >> On 16.5.2012 10:36, zayatzz wrote: >> >>> /opt/bin/python^M: bad interpreter: No such file or directory >> Your script has CRLF end-of-lines. Change it to plain Unix LF. >> >> Matěj > Thanks :) but i have no idea wh

Re: Newbie questions on import & cmd line run

2012-05-17 Thread Dave Angel
On 05/17/2012 12:54 AM, alex23 wrote: > On May 17, 11:45 am, gwhite wrote: > > I don't think that only-one-import is true for scripts that are run > from the command line, though. They can exist as both '__main__' and > their actual name in the module table. (Someone please correct me if > this

Re: append method

2012-05-23 Thread Dave Angel
On 05/23/2012 03:13 PM, Emile van Sebille wrote: > On 5/23/2012 5:23 AM 水静流深 said... >> >>> s=[1,2,3] >> >>> s.append(5) >> >>> s >> [1, 2, 3, 5] >> >>> s=s.append(5) >> >>> s >> >>> print s >> None >> >> why can't s=s.append(5) > > It could, but it doesn't. > > >> ,what is the reason? > > >

Re: Help doing it the "python way"

2012-05-24 Thread Dave Angel
On 05/24/2012 04:22 PM, Scott Siegler wrote: > Hello, > > I am an experienced programmer but a beginner to python. As such, I can > figure out a way to code most algorithms using more "C" style syntax. > > I am doing something now that I am sure is a more python way but i can't > quite get it ri

Re: Scoping Issues

2012-05-24 Thread Dave Angel
On 05/24/2012 09:23 PM, SherjilOzair wrote: > def adder(): > s = 0 > def a(x): > s += x > return sum > return a > > pos, neg = adder(), adder() > for i in range(10): > print pos(i), neg(-2*i) > > This should work, right? Why does it not? > Guess that dep

Re: Scoping Issues

2012-05-24 Thread Dave Angel
On 05/24/2012 10:27 PM, Andrew Berg wrote: > On 5/24/2012 8:59 PM, Dave Angel wrote: >> so I fixed that, and got >> inconsistent use of tabs and spaces in indentation >> >> because you mistakenly used tabs for indentation. > Not to start another tabs-vs.-s

Re: getting started

2012-05-25 Thread Dave Angel
On 05/25/2012 09:12 AM, Harvey Greenberg wrote: > elementary ques...I set > s.name = ["a","b"] > s.value = [3,5] > > I get error that s is not defined. How do I define s and proceed to > give its attributes? You just have to initialize s as an object that's willing to take those attributes. The

Re: mistake in python tutorial

2012-06-05 Thread Dave Angel
On 06/05/2012 09:43 PM, Miriam Gomez Rios wrote: > Hello, I think that the example in section 4.4 in the tutorial for python > 2.7X is wrong. > > http://docs.python.org/tutorial/controlflow.html > > > > It will end up printing this if you run the exact code listed in the tutorial. > > > > 3 is a p

Re: Searching 2 Strings in A File

2012-06-06 Thread Dave Angel
On 06/06/2012 05:10 PM, dohoang4...@comcast.net wrote: > hi all, (You forgot to include the list in your reply) > > thanks a lot for your quick response. > > Dave, actually it's a 2 arguments. Sorry, i did not make it clear in my > question. I used Ramit's hint and it worked. The code should

Re: Where to set default data - where received, or where used

2012-06-11 Thread Dave Angel
On 06/11/2012 02:37 PM, Dennis Carachiola wrote: > I'm programming a project which will use a file to save parameters > needed by the program. There are already two previous file formats, > each of which can only be run by the version of the program which > created them. I'm trying to avoid that

Re: Threads vs subprocesses

2012-06-15 Thread Dave Angel
On 06/15/2012 09:49 AM, John O'Hagan wrote: > I have a program in which the main thread launches a number of CPU-intensive > worker threads. For each worker thread two python subprocesses are started, > each of which runs in its own terminal: one displays output received from the > worker thread vi

Re: module name vs '.'

2012-06-18 Thread Dave Angel
On 06/18/2012 09:19 AM, Neal Becker wrote: > Am I correct that a module could never come from a file path with a '.' in > the > name? > No. Simple example: Create a directory called src.directory In that directory, create two files ::neal.py:: import becker print becker.__file__ print becker.h

Re: module name vs '.'

2012-06-18 Thread Dave Angel
On 06/18/2012 09:47 AM, Neal Becker wrote: > I meant a module > > src.directory contains > __init__.py > neal.py > becker.py > > from src.directory import neal > > > On Mon, Jun 18, 2012 at 9:44 AM, Dave Angel wrote: > >> On 06/18/2012 09:19 AM,

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Dave Angel
On 06/18/2012 10:00 AM, jmfauth wrote: > > A string is a string, a "piece of text", period. I do not see why a > unicode literal and an (well, I do not know how the call it) a "normal > class " should behave differently in code source or as an answer > to an input(). Wrong. The rules for parsi

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Dave Angel
On 06/18/2012 12:55 PM, Andrew Berg wrote: > On 6/18/2012 11:32 AM, Jussi Piitulainen wrote: >> jmfauth writes: >> >>> Thinks are very clear to me. I wrote enough interactive >>> interpreters with all available toolkits for Windows > r = input() >> u'a >> Traceback (most recent call last): >>

Re: Newby Python help needed with functions

2011-06-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Cathy James wrote: I need a jolt here with my python excercise, please somebody!! How can I make my functions work correctly? I tried below but I get the following error: if f_dict[capitalize]: KeyError: Code below: def capitalize (s): """capitalize accepts a

Re: test_popen

2011-06-09 Thread Dave Angel
On 01/-10/-28163 02:59 PM, harrismh777 wrote: Looks like my 2.7 test_popen failure is an open issue7671... since Jan 2010. Looks like it really does function ok. At any rate, I was able to test Popen myself today, and it ran fine. I needed to write a script that will disable the touch pad on thi

Re: Any Better logic for this problem..

2011-06-09 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Rebert wrote: On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium wrote: Hi Guru's, I'm working on a solution to find the prime factor of the number This part of the code works.. http://www.pastie.org/2041584 For the archives, that code is: num =3195 #num

Re: working with raw image files

2011-06-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, kafooster wrote: On 14 Cze, 22:26, MRAB wrote: Multiply the numpy array by a scaling factor, which is float(max_8bit_value) / float(max_16bit_value). could you please explain it a little? I dont understand it. like multiplying each element? You said in an earlie

Re: working with raw image files

2011-06-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, kafooster wrote: On 15 Cze, 01:25, Dave Angel wrote: On 01/-10/-28163 02:59 PM, kafooster wrote: On 14 Cze, 22:26, MRABwrote: Multiply the numpy array by a scaling factor, which is float(max_8bit_value) / float(max_16bit_value). could you please explain

Re: break in a module

2011-06-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Eric Snow wrote: Unfortunately not. Most of this line of thinking is the result of looking at import functionality in different ways, including with regards to the problem of modules getting imported twice (once as __main__). I've been doing work on multi-file modul

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: Significant figures calculation

2011-06-27 Thread Dave Angel
(You top-posted your reply, instead of writing your response following the part you were quoting) On 01/-10/-28163 02:59 PM, Lalitha Prasad K wrote: In numerical analysis there is this concept of machine zero, which is computed like this: e=1.0 while 1.0+e> 1.0: e=e/2.0 print e The numb

Re: Problem!!

2011-07-04 Thread Dave Angel
On 01/-10/-28163 02:59 PM, amir chaouki wrote: the problem is when i use the seek function on windows it gives me false results other then the results on *ux. the file that i work with are very large about 10mb. If you still care about this problem, you should take some of the other suggestio

Re: Finding duplicated photo

2011-07-08 Thread Dave Angel
On 01/-10/-28163 02:59 PM, TheSaint wrote: Hello, I came across the problem that Gwenview moves the photo from the camera memory by renaming them, but later I forgot which where moved. Then I tought about a small script in python, but I stumbled upon my ignorance on the way to do that. PIL can

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Anthony Kong wrote: Hi, all, Lately I am giving some presentations to my colleagues about the python language. A new internal project is coming up which will require the use of python. One of my colleague asked an interesting: *If Python use indentation to denote sco

Re: Re: Virtual functions are virtually invisible!

2011-07-16 Thread Dave Angel
On 01/-10/-28163 02:59 PM, rantingrick wrote: On Jul 16, 5:34 pm, Fabio Zadrozny wrote: I also like the idea of override annotations and I've created a blog post at:http://pydev.blogspot.com/2011/06/overrideimplements-templates-on-pyd... to explain how I do use it (and in a way that I think sh

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Steven D'Aprano wrote: Tim Chase wrote: On 07/17/2011 08:01 PM, Steven D'Aprano wrote: Roy Smith wrote: We don't have that problem any more. It truly boggles my mind that we're still churning out people with 80 column minds. I'm willing to entertain arguments abou

Re: Partial Function Application -- Advantages over normal function?

2011-07-18 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Terry Reedy wrote: On 7/18/2011 8:24 AM, Paul Woolcock wrote: Partial function application (or "currying") is the act of taking a function with two or more parameters, and applying some of the arguments in order to make a new function. The "hello world" example for th

Re: Re: Partial Function Application -- Advantages over normal function?

2011-07-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Thomas 'PointedEars' Lahn wrote: Dave Angel wrote: On 01/-10/-28163 02:59 PM, Terry Reedy wrote: def makeadder(y) def _add(x): return x+y add2 = makeadder(2) A couple of typos in that code: def makeaddr(y): def _add(x): return x+y retu

Re: How to iterate through two dicts efficiently

2011-07-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, J wrote: Hello, I am looking to improve the performance of the following piece of Python code:- for cc in StatusContainer: for srv in StatusContainer[cc]: for id in StatusContainer[cc][srv]['RECV']: if id in StageContain

Re: Decorator behavior

2011-07-22 Thread Dave Angel
On 01/-10/-28163 02:59 PM, mhearne808[insert-at-sign-here]gmail[insert-dot-here]com wrote: I am just trying to wrap my head around decorators in Python, and I'm confused about some behavior I'm seeing. Run the code below (slightly adapted from a Bruce Eckel article), and I get the following outp

Re: How can I make a program automatically run once per day?

2011-07-27 Thread Dave Angel
On 01/-10/-28163 02:59 PM, John Salerno wrote: On Jul 26, 9:22 pm, Andrew Berg wrote: On 2011.07.26 08:05 PM,JohnSalernowrote:> Hmm, okay I'm finally trying Task Scheduler, but how do I set it to run a Python script? It seems to not work, I suppose because it's running the script but doesn't

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Dave Angel
On 01/-10/-28163 02:59 PM, jc wrote: # Get Fibonacci Value #Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2) # # n = 900 is OK # n = 1000 is ERROR , Why # # What Wrong? # cache = [] def fibo( n ): try: if cache[n] != -1: return cache[n] else:

Re: Equality check

2011-08-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Abhishek Jain wrote: How to check equality of two nos. in python Python doesn't have numbers, it has various numeric data types. If all you're concerned with are int types, then just use the obvous: if a == b: dosomething If one or both might

Re: problem with bcd and a number

2011-08-04 Thread Dave Angel
On 01/-10/-28163 02:59 PM, nephish wrote: Hey all, I have been trying to get my head around how to do something, but i am missing how to pull it off. I am reading a packet from a radio over a serial port. i have " two bytes containing the value i need. The first byte is the LSB, second is MSB.

Re: thread and process

2011-08-13 Thread Dave Angel
On 01/-10/-28163 02:59 PM, 守株待兔 wrote: please see my code: import os import threading print threading.currentThread() print "i am parent ",os.getpid() ret = os.fork() print "i am here",os.getpid() print threading.currentThread() if ret == 0: print threading.currentThread() els

Re: Re: allow line break at operators

2011-08-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Roy Smith wrote: In article<4e47db26$0$30002$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: Er, most URLs are case insensitive, at least the most common ones, including HTTP and HTTPS. So I don't quite see why you think this was a Whoops. URLs are mos

Re: Ten rules to becoming a Python community member.

2011-08-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, rantingrick wrote: On Aug 14, 12:57 am, rantingrick wrote: 9. Never use the word "previously" or the phrase "in the past"; just dumb it down with "used to". I had forgot to mention one other usage of "used to": WRONG: "I used to not like indention but know i am ver

Re: reading and writing files

2011-08-23 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Adrián Monkas wrote: Hi. I`ve been trying to copy a long text from one file to another but it always copied me just a small part. I would be glad if you can help me or explain which is my error. Thanks ---

Unspecified problem sending serial data

2011-08-24 Thread Dave Angel
Former subject line: reading and writing files On 08/24/2011 01:05 PM, Adrián Monkas wrote: Hi. thanks for answering so soon. What i want to do is send around 180KBytes via Serial port. First of all i have been trying to read from a file this amount of information and copy to another file. Tha

Re: Unload a DLL

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Sathish S wrote: Hi Ppl, I'm loading a dll using the *cdll.LoadLibrary *function. How can I release the dll after I'm done with it. Are there any functions to do this. Thanks, Sathish In Windows, the FreeLibrary() call will decrement the load count, and unload the

Re: Running Scripts vs Interactive mode

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, grobs456 wrote: #I set my system environment variables to: VARIABLEVALUE PYTHON_HOME c:\python27\python.exe PATH...;%PYTHON_HOME% #after also trying this: VARIABLEVALUE PYTHON_HOME c:\python2

Re: Python encoding question

2011-02-25 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Marc Muehlfeld wrote: Hi, TEST = cursor.fetchone() print TEST[0] print TEST When I run this script It prints me: München ('M\xc3\xbcnchen',) Why is the Umlaut of TEST[0] printed and not from TEST? When you print a string, it simply prints it, control character

Re: A question about Cmd Class

2011-03-08 Thread Dave Angel
On 01/-10/-28163 02:59 PM, yuan zheng wrote: Hello, everyone: I encouter a question when implementing a commmand line(shell). I have implemented some commands, such as "start", "stop", "quit", they are easily implemented by "do_start", "do_stop" and "do_quit". there are no troubles. B

Re: A question about Cmd Class

2011-03-10 Thread Dave Angel
On 03/10/2011 01:38 AM, yuan zheng wrote: Thanks for your help. thanks, yuanzheng. 2011/3/8 Dave Angel On 01/-10/-28163 02:59 PM, yuan zheng wrote: Hello, everyone: I encouter a question when implementing a commmand line(shell). I have implemented some commands, such as "

Re: puzzle about file Object.readlines()

2011-03-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, MRAB wrote: On 19/03/2011 13:15, 林桦 wrote: i use python 2.5. os is window 7. the puzzle is :python don't read the leave text when meet character: chr(26) the code is: /fileObject=open('d:\\temp\\1.txt','w') fileObject.write('22\r\n') fileObject.write(chr(26

Re: python time

2011-03-20 Thread Dave Angel
On 01/-10/-28163 02:59 PM, ecu_jon wrote: I'm working on a script that will run all the time. at time specified in a config file, will kick-off a backup. problem is, its not actually starting the job. the double while loop runs, the first comparing date works. the second for hour/min does not. #

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Andrea Crotti wrote: John Ladasky writes: Simple question. I use these functions much more frequently than many others which are included in __builtins__. I don't know if my programming needs are atypical, but my experience has led me to wonder why I have to import

Re: Re: Equivalent code to the bool() built-in function

2011-04-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Daniel Kluev wrote: On Sun, Apr 17, 2011 at 8:38 AM, Ben Finney wrote: It won't look up the *name* ‘bool’, but it will use that object. Any boolean expression is going to be calling the built-in ‘bool’ type constructor. So the answer to the OP's question is no: the f

Re: Feature suggestion -- return if true

2011-04-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Angelico wrote: Sure. In my (somewhat contrived) example of factorials, that's going to be true (apart from 0! = 0); and if the function returns a string or other object rather than an integer, same thing. If there's the Just to be pedantic, by any reasonable

Re: [OT] Piling of prepositions (was: Namespaces in functions vs classes)

2011-04-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Ben Finney wrote: "Rhodri James" writes: Language abuse: it's not just Python. A donation of just $5 will keep a programmer in prepositions for a month. $50 will supply enough articles to keep a small company understandable for over a year. With your generous help, w

Re: Re: learnpython.org - an online interactive Python tutorial

2011-04-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, harrismh777 wrote: Cameron Simpson wrote: | folks are not aware that 'bc' also has arbitrary precision floating | point math and a standard math library. Floating point math? I thought, historically at least, that bc is built on dc (arbitrary precision integer math, r

Re: Fibonacci series recursion error (slightly OT)

2011-05-02 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Angelico wrote: On Mon, May 2, 2011 at 3:36 PM, Hans Georg Schaathun wrote: On Mon, 2 May 2011 06:49:41 +1000, Chris Angelico wrote: : Sure. Serialize this Python object in a way that can be given to, say, PHP: : foo=asdf":"qwer","zxcv":"1234"}; foo["self"

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, rusi wrote: On May 3, 10:29 am, Chris Angelico wrote: On Tue, May 3, 2011 at 3:27 PM, Dan Stromberg wrote: Doh. Usually when someone gives a recursive solution to this problem, it's O(logn), but not this time. Here's a logn one: :-) Ok so you beat me to it :D

Re: Obtaining a full path name from file

2011-05-25 Thread Dave Angel
On 01/-10/-28163 02:59 PM, RVince wrote: s = "C:\AciiCsv\Gravity_Test_data\A.csv" f = open(s,"r") How do I obtain the full pathname given the File, f? (which should equal "C:\AciiCsv\Gravity_Test_data"). I've tried all sorts of stuff and am just not finding it. Any help greatly appreciated !

Re: searching in list

2011-05-30 Thread Dave Angel
On 01/-10/-28163 02:59 PM, vino19 wrote: I want to make a function that is called only once per one argument. I mean I want to store data of function calling to prevent calling it again if there is no need. How to make it? For example I can make a global list that just consist of tuples [(arg1,

Python Certification training for Data Science

2019-07-26 Thread angel . thomas1717
This is a comprehensive course to learn Python Programming for Data Science, Data Analysis and Data Visualization In this course we will learn: 1) Complete understanding of Python from Scratch 2) Python for Data Science and Business Analysis List of some Topics that we will cover, 1) NumPy : N

7 Reasons Why You Should Keep Learning C/C++

2019-08-05 Thread angel . thomas1717
Many programmers are frustrated with and leaning away toward the C/C++ programming languages because of the following reasons: (1) Very steep learning curve.. Many people joined the programming world by learning C or C++, but it’s rare for them to keep learning and mastering these two languages

10 Reasons Why You Should Keep Learning Game Development

2019-08-08 Thread angel . thomas1717
If you ask any software developer, there’s a decent chance that they have tried their hand at game development. It seems like a natural fit since it uses many of the same skills. What’s more, programmers come into it with the knowledge that most aspiring game makers lack: how to write good code

Python launcher

2020-04-15 Thread Angel V
program onto my brother's computer and it did the same things. Any suggestions? Thank you so much, Angel Viskinda -- https://mail.python.org/mailman/listinfo/python-list

Re: Please help with this

2013-11-12 Thread Dave Angel
On Tue, 12 Nov 2013 20:18:58 -0800 (PST), saad imran wrote: Could you point out any errors in my code: que1 = "4481 *2" ans1 = "8962" que2 = "457 * 21" ans2 = "9597" These values should all be in a single named structure, probably a list of tuples. Then all that duplicated code could be cond

Re: The Spirit of Python

2013-11-14 Thread Dave Angel
On Thu, 14 Nov 2013 13:11:08 -0500, Roy Smith wrote: Intriguing subject line but an empty message body. Please post in text not html if you want everyone to see it. Thanks -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Implementing #define macros similar to C on python

2013-11-14 Thread Dave Angel
On Thu, 14 Nov 2013 18:29:48 -0800 (PST), JL wrote: One of my favorite tools in C/C++ language is the preprocessor macros. One example is switching certain print messages for debugging use only #ifdef DEBUG_ENABLE DEBUG_PRINT print #else DEBUG_PRINT Is it possible to implement some

Re: The Spirit of Python

2013-11-14 Thread Dave Angel
On Fri, 15 Nov 2013 15:16:09 +1100, Ben Finney wrote: Dave Angel writes: > On Thu, 14 Nov 2013 13:11:08 -0500, Roy Smith wrote: > Intriguing subject line but an empty message body. Please post in text > not html if you want everyone to see it. My message agent also

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Dave Angel
On Sat, 16 Nov 2013 07:15:01 -0800 (PST), Ferrous Cranus wrote: 'locate pythοn3.4 | rm -rf' will this help or do any accidental damage? The files deleted by the rm -rf have nothing to do with the results of locate. Since you don't understand that , your system is at high risk till you

Re: Data structure question

2013-11-17 Thread Dave Angel
On Mon, 18 Nov 2013 02:03:38 +, "Joseph L. Casale" wrote: I have a need for a script to hold several tuples with three values, two text strings and a lambda. I need to index the tuple based on either of the two strings. Normally a database would be ideal but for a self-contained script

Re: Oh look, another language (ceylon)

2013-11-18 Thread Dave Angel
On 18 Nov 2013 14:30:54 GMT, Steven D'Aprano wrote: - 15 bits for a length. 15 bits give you a maximum length of 32767. There are ways around that. E.g. a length of 0 through 32766 means exactly what it says; a length of 32767 means that the next two bytes are part of the length too, givi

Re: Building a tree-based readline completer

2013-11-18 Thread Dave Angel
On Mon, 18 Nov 2013 08:55:05 -0800 (PST), roey.k...@gmail.com wrote: On Monday, November 18, 2013 11:54:43 AM UTC-5, roey wrote: > Thank you. In looking over these classes, I see though that even them, I would run against the same limitations, though. Please don't double space your quotes. A

Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Dave Angel
On 20 Nov 2013 00:17:23 GMT, Steven D'Aprano wrote: problem by hand. I'll get you started by solving the problem for 7. Positive integers less than 23 are 1, 2, 3, 4, 5, 6. So let's start checking them for divisors: Where did 23 come from? - 1 is not divisible by 2, 3 or 5, so we coun

Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Dave Angel
On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano wrote: 2 does count because it isn't divisible by 3. The question states, "[count] how many positive integers less than N are not divisible by 2,3 or 5". Two is not divisible by 3, so "not divisible by 2,3 or 5" is true, so two gets counted. Th

Re: using getattr/setattr for local variables in a member function

2013-11-21 Thread Dave Angel
On Fri, 22 Nov 2013 00:52:21 +, MRAB wrote: > If I have a class that has some member functions, and all the functions > define a local variable of the same name (but different type), is there > some way to use getattr/setattr to access the local variables specific > to a given function

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-22 Thread Dave Angel
Try posting in text, as some of us see nothing in your message. This is a text newsgroup, not html. Also make a subject line that summarizes your issue, not the urgency. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me to print to screen as well as log

2013-11-23 Thread Dave Angel
On Sat, 23 Nov 2013 05:11:11 -0800 (PST), Himanshu Garg wrote: How can I write to the same file from two different scripts opened at same time? Using what version of python and on what OS? Sone OS's will open the file exclusively by default. Others will let you stomp all over some other proc

Re: Excute script only from another file

2013-11-24 Thread Dave Angel
On Sun, 24 Nov 2013 17:55:08 -0800 (PST), Himanshu Garg wrote: Like, I have two scripts "scrip1.py" and "script2.py" and there is a line in "script1.py" to call "script2.py" as subprocess.call(["python", "script2.py"]). Then this is should call script2 but I should not be able to directly

Re: Excute script only from another file

2013-11-25 Thread Dave Angel
On Mon, 25 Nov 2013 02:52:46 -0800 (PST), Himanshu Garg wrote: My motive is "I will give scripts to somebody else and he should not run the script directly without running the parent script". Perhaps it should be a module, not a script. Have it protect itself with the usual if __name__ == "_

<    3   4   5   6   7   8   9   10   11   12   >