Re: [Tutor] sqlite3 making a spurious duplicate?

2017-04-19 Thread Marilyn Davis
Thank you Alan, Steven and Peter, So, this call: connection.execute("SELECT * FROM BRIGHTEST") returns a , not a regular python sequence. I did not know that. And, the connection must still be alive when you iterate it. That is a very important tidbit of info. The fix is to listify the Curso

[Tutor] sqlite3 making a spurious duplicate?

2017-04-17 Thread Marilyn Davis
#!/usr/bin/env python3 """ Hello Tutors, I can't figure out why the FillWithStars() function puts Canopus in the db twice. What am I missing? Thank you for any help. Marilyn Davis p.s. That Reset(db_name) is in there so that you can run it over and over if you want

Re: [Tutor] __repr__ and __str__

2015-06-30 Thread Marilyn Davis
Thank you so much Alan and Steve. We are good now. Marilyn On Tue, June 30, 2015 6:10 am, Steven D'Aprano wrote: > On Mon, Jun 29, 2015 at 11:47:45PM -0700, Marilyn Davis wrote: > >> Hello Python Tutors, >> >> >> A student has asked a question tha

[Tutor] __repr__ and __str__

2015-06-30 Thread Marilyn Davis
fines __repr__() but not __str__(), then __repr__() is also used when an “informal” string representation of instances of that class is required. __ So ????? __str__ is defined and works just fine unless we also define __repr__. What am I missing? Thank you for any help. Marilyn Davis _

Re: [Tutor] unicode help

2012-11-14 Thread Marilyn Davis
On Wed, November 14, 2012 1:07 pm, Marilyn Davis wrote: > Thank you, Dave, for looking at my problem, and for correcting me on my > top posting. > > See below: > > > On Wed, November 14, 2012 12:34 pm, Dave Angel wrote: > > >> On 11/14/2012 03:10 PM,

Re: [Tutor] unicode help

2012-11-14 Thread Marilyn Davis
Thank you, Dave, for looking at my problem, and for correcting me on my top posting. See below: On Wed, November 14, 2012 12:34 pm, Dave Angel wrote: > On 11/14/2012 03:10 PM, Marilyn Davis wrote: > >> Hi, >> >> >> Last year, I was helped so that this ran nicely o

Re: [Tutor] unicode help

2012-11-14 Thread Marilyn Davis
an anyone please help? It says 'ascii' codec? Shouldn't it be seeing 'utf-8'? I can't imagine it matters but I'm on an imac now and before I was on Ubuntu. Thank you, Marilyn Davis On Sat, May 28, 2011 2:17 pm, Marilyn Davis wrote: > Thank you Ma

Re: [Tutor] checking if a variable is an integer?

2011-06-02 Thread Marilyn Davis
True that! This is the nicest, most patient, most knowledgeable, technical list I've ever experienced. That's why I keep coming back when I am hopelessly confused. Thank you. Marilyn Davis On Thu, June 2, 2011 7:04 am, Prasad, Ramit wrote: >> If not, he can google the

Re: [Tutor] __init__.py question

2011-06-02 Thread Marilyn Davis
te so stupid. Thank you folks. Marilyn Davis On Wed, June 1, 2011 5:11 pm, Steven D'Aprano wrote: > Marilyn Davis wrote: > [...] > >> There's something I'm missing because I think you simply can't call >> something string.py unless you are willing to give

Re: [Tutor] __init__.py question

2011-06-01 Thread Marilyn Davis
so that I can fix up my naming/architecture mistake rather than depend on, and struggle with, the __init__.py scheme. I teach Python and this is always a hard part for people. It might help if I understand it better. Marilyn Davis On Wed, June 1, 2011 11:52 am, Alexandre Conrad wrote: &

Re: [Tutor] __init__.py question

2011-06-01 Thread Marilyn Davis
f allowing this when it is, IMHO, an architectural mistake. There must be something I'm missing or some wrong thinking described here because Guido is so smart, and it's still in 3.x. If anyone has an insight, I would really appreciate some help on this point, which has bothered me a bit for

[Tutor] __init__.py question

2011-05-31 Thread Marilyn Davis
occur later on in the module search path. An example would probably set me straight. Can anyone help with that? Marilyn Davis ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/lis

Re: [Tutor] checking if a variable is an integer?

2011-05-31 Thread Marilyn Davis
ber that you can skip the testing for all even numbers. They aren't prime. That'll cut your run time in half, about. Marilyn Davis On Tue, May 31, 2011 2:40 pm, Rachel-Mikel ArceJaeger wrote: > Isn't one of the unsolved millenium prize problems one that includes the > abi

Re: [Tutor] Importing classes when needed

2011-05-30 Thread Marilyn Davis
If we are coding via a vote, I'd be with Alan. If Timo adds non-parser modules, and they get through his glob filter, then surely his code will break with a nice error statement and that would remind him of his convention. Or maybe it would just give a verbose report and go on to the next file.

Re: [Tutor] Finding error from os.system(cmd)

2011-05-30 Thread Marilyn Davis
(some-stuff-that-is-already-a-str), which is a waste, and a little confusion for your reader. I hope you find some help in these suggestions. Marilyn Davis On Mon, May 30, 2011 5:28 am, Kann Vearasilp wrote: > Dear all, > > > I tried using python to execute some external java progra

Re: [Tutor] unicode help

2011-05-28 Thread Marilyn Davis
x # -*- coding: utf8 -*- by Martin is > equivalent, but I always have a hard time remembering it from the top of my > head when I create a new Python file. So I just use: # coding: utf-8 > > > > 2011/5/28 Marilyn Davis : > >> Thank you Alexandre for your quick reply. >> &g

Re: [Tutor] unicode help

2011-05-28 Thread Marilyn Davis
Thank you Martin, This: #!/usr/bin/env python # -*- coding: utf8 -*- '''Unicode handling for 2.6. ''' [rest of module deleted] produces an emacs warning: Warning (mule): Invalid coding system `utf8' is specified for the current buffer/file by the :coding tag. It is highly recommended to fix it

Re: [Tutor] unicode help

2011-05-28 Thread Marilyn Davis
utting at the top of your file the > encoding of your file: > > After the shebang (1st line), add the following comment: > # coding: utf-8 > > > (or whatever encoding your file is saved to, I think it depends on > your file system, usually utf-8 by default on Linux) > >

[Tutor] unicode help

2011-05-28 Thread Marilyn Davis
Hi, I'm still on Python 2.6 and I'm trying to work some unicode handling. I've spent some hours on this snippet of code, trying to follow PEP 0263, since the error tells me to see it. I've tried other docs too and I am still clueless. The code works, except for the comment at the end. I would

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Marilyn Davis
On Tue, June 24, 2008 10:16 pm, Dick Moores wrote: > At 07:00 PM 6/24/2008, Marilyn Davis wrote: > > >> Has anyone ever timed the difference between using a function that was >> imported with: >> >> from my_module import MyFunction >> >> and: >>

[Tutor] [Fwd: Re: Astonishing timing result]

2008-06-24 Thread Marilyn Davis
he difference we see is the whole sort. That makes sense. Thank you for the understanding. Has anyone ever timed the difference between using a function that was imported with: from my_module import MyFunction and: import my_module and then my_module.MyFunction() Also, if anyone is still

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Marilyn Davis
of t2. What if __name__ != '__main__' ? >> >> With that, >> t1 is 0.000104, no function t2 is 0.000117, function explicit t3 is >> 0.000113, function imported >> t1/t2 is 0.885 t1/t3 is 0.914 t3/t2 is 0.969 >> >> Explain? Does this mean that if __name__

[Tutor] [Fwd: Re: From Newbie]

2008-06-22 Thread Marilyn Davis
#x27; are all smashed together without spaces. So: > while a ! = 0: Should be: while a != 0: That should get you going again. Marilyn Davis > > The same would go for s > > > hope that helps > > paul > > On Sun Jun 22 10:45 , Danny Laya sent: > > > > > &

[Tutor] [Fwd: Re: Dictionary within a dictionary]

2008-06-13 Thread Marilyn Davis
On Fri, June 13, 2008 4:09 pm, Alan Gauld wrote: > "Marilyn Davis" <[EMAIL PROTECTED]> wrote > > >> When see nested builtin data structures, I always think it's time to >> think of making a few classes instead. > > It could be, especially if you are

Re: [Tutor] Dictionary within a dictionary

2008-06-13 Thread Marilyn Davis
st: When see nested builtin data structures, I always think it's time to think of making a few classes instead. Python tutors, is this a good suggestion? Marilyn Davis > > > [{'id': , > 'category': [{'id': , > 'sub-category':

Re: [Tutor] do I need f.close()

2008-06-12 Thread Marilyn Davis
files, its really for writing > that you want to be explicit. Alan, will the file close, even if it was opened for writing, when the program ends? I know it stays open if you're interactive, but otherwise too? Marilyn Davis > > Alan G. > > > > _

Re: [Tutor] powerball

2008-06-12 Thread Marilyn Davis
On Wed, June 11, 2008 9:42 pm, max baseman wrote: > hello and thank you everyone for your help. I apologize for my ignorance > when it came to knowledge of what the powerball is it is not as wide > spread as i had thought it was > > the powerball is a form of lottery their are 5 numbers between 1

[Tutor] [Fwd: Re: powerball]

2008-06-11 Thread Marilyn Davis
] powerball From:"max baseman" <[EMAIL PROTECTED]> Date:Wed, June 11, 2008 7:22 pm To: "Marilyn Davis" <[EMAIL PROTECTED]> -- thank you for your help i beleave i have fixed this bug and

Re: [Tutor] powerball

2008-06-11 Thread Marilyn Davis
these would go away by using 'for' 'in' and 'range'. > It looks like a fun program and a good start. > Marilyn Davis if number in win: numbers.append(number) else: print "lose" break numbers.sort() ball=

Re: [Tutor] static methods and class methods

2008-06-10 Thread Marilyn Davis
name. Wesley has them. Class methods and static methods can be called, even when you don't have an instance of the class. I think that that's all there is to it. With the class method, the interpreter provides the class itself as the first argument. With the static, nothing comes in. Wh

Re: [Tutor] doc string format ?

2008-06-08 Thread Marilyn Davis
y provides for free. But, mostly, I have to say that your instinct is good. Marilyn Davis > > Cheers > > > Dave > > > > > def gen_vhost(kmotion_dir): """ > Generate the kmotion vhost file from vhost_template expanding %directory% > strings

Re: [Tutor] how to read a program

2008-06-06 Thread Marilyn Davis
This is pretty cool: http://aspn.activestate.com/ASPN/Python/Cookbook/ Marilyn Davis On Fri, June 6, 2008 4:34 pm, Anthony Parks wrote: > that sounds like good advice, but i think what i meant is something along > the lines of: > > "what are particularly great programs to

Re: [Tutor] [Fwd: Re: Intercepting methods calls]

2008-06-06 Thread Marilyn Davis
On Fri, June 6, 2008 3:37 pm, Andreas Kostyrka wrote: > On Friday 06 June 2008 18:19:23 you wrote: > >> On Thu, June 5, 2008 9:39 am, Andreas Kostyrka wrote: >> >>> On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote: >>> >>>> You liste

[Tutor] [Fwd: Re: Intercepting methods calls]

2008-06-04 Thread Marilyn Davis
class A: def SaySomething(self): print 'this' import a_def def SayElse(dummy=None): print 'that' a_def.A.SaySomething = SayElse a_def.A().SaySomething() --- and 'that' came out. I guess the A class could have been written to prevent that

Re: [Tutor] Intercepting methods calls

2008-06-03 Thread Marilyn Davis
o that kind of thing. > Can you give us some more background on what you are > trying to achieve that makes you need to do that? Great question, Alan. But, whatever the answer, I'd like to see the variations listed, if you have time. Showing my ignorance, I can only think of inheritance/ove

Re: [Tutor] finding special character string

2008-06-03 Thread Marilyn Davis
e) > > How did I solve it? I found a list of all the special words, created a And here I might think that finding a list of all special words, unless you found them using Python on the text file, isn't quite what was intended. It is really hard to write specifications. It seems

Re: [Tutor] finding special character string

2008-06-01 Thread Marilyn Davis
On Sun, June 1, 2008 4:58 pm, Kent Johnson wrote: > On Sun, Jun 1, 2008 at 2:04 PM, Marilyn Davis <[EMAIL PROTECTED]> > wrote: > >> On Sun, June 1, 2008 10:30 am, Alan Gauld wrote: >> >> >>> "Kent Johnson" <[EMAIL PROTECTED]> wrote >

Re: [Tutor] finding special character string

2008-06-01 Thread Marilyn Davis
# Line starts with the name \b # followed by a non-word character (?:# Un-captured group [^:]+? # of non-colons :){2} # followed by a colon, twice It broke here: x # a mistake!!! \d+? # some digits [ ]+ # one or spaces in [] (?P# capturing a gr

[Tutor] Readability, in general: was Re: Reading only a few specific lines of a file

2008-05-23 Thread Marilyn Davis
On Fri, May 23, 2008 10:06 am, Alan Gauld wrote: > "Marilyn Davis" <[EMAIL PROTECTED]> wrote > > >> (I'm sorry for the duplicate, Alan.) >> > > I didn't see a duplicate! ;-) > > >>> linecount = 0 for line in file("itemconfi

Re: [Tutor] Reading only a few specific lines of a file

2008-05-23 Thread Marilyn Davis
like "for x in range(5):" to go 5 times. I'm not sure what we should be doing 5 times either. Similarly, for readability, I choose the if/elif/else form of switch replacement. Also, I don't like to see the obfuscated forms of the conditional operator. Heck, I'm not even c

[Tutor] New Style Classes, __getitem__ and iteration

2008-05-19 Thread Marilyn Davis
Hi Tutors and Tutees, I've been teaching Python quite a while and a brilliant student asked a question that made me realize a big hole in my understanding. I think it is really magical that, when I define __getitem__ on classic classes, the built-in iterator uses it. But, when I make the same cl

Re: [Tutor] Inherit from int?

2007-05-13 Thread Marilyn Davis
Thank you everyone. I, indeed, found it in your book, Wes, after I knew it was something extra special. The explanations here are great! Thank you everyone. Marilyn On Sun, 13 May 2007, wesley chun wrote: > > I'm stumped. This silly bit of code doesn't work. I expect the > > output to be

[Tutor] Inherit from int?

2007-05-12 Thread Marilyn Davis
umber): number %= 10 int.__init__(self, number) if __name__ == '__main__': n = Under10(18) print n ''' $ ./new_style.py 18 ''' Any ideas? Thank you. Marilyn Davis ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] re and MULTILINE

2007-02-20 Thread Marilyn Davis
On Tue, 20 Feb 2007, Kent Johnson wrote: > Marilyn Davis wrote: > > Hello Tutors, > > > > I'm trying to get a grip on MULTILINE and I guess I don't have it. > > > > Here's some code: > > > > #!/usr/bin/env python > > import re &g

[Tutor] re and MULTILINE

2007-02-20 Thread Marilyn Davis
ne. What's up with that? What I really want, is to mess with each of the last digit-groups on each line. But I can't find them. The exercise is from Ellie Quigley's "Perl by Example" Thank you for any help. Marilyn Davis ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] IDE - Editors - Python

2006-02-06 Thread Marilyn Davis
On Mon, 6 Feb 2006, Danny Yoo wrote: > >Avoid debuggers like a plague. If someone applies for a job > > with us and starts talking about their proficiency in > > debuggers, the interview stops right there and we keep looking. I can see that bragging about "proficiency in deb

Re: [Tutor] A question

2006-02-05 Thread Marilyn Davis
On Sun, 5 Feb 2006, Marilyn Davis wrote: > On Sun, 5 Feb 2006, Bian Alex wrote: > > > How can I get a string from a random file. > > For Example: > > Delete On : Copy > > Owner : Bn > > Personalized: 5 > > PersonalizedName:

Re: [Tutor] A question

2006-02-05 Thread Marilyn Davis
start. found = text[start:end].strip() <-- found has the text you want, with any spaces stripped off. I hope it helps. I didn't test it. Marilyn Davis > > Pls help. > -- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Quoting trouble

2006-01-20 Thread Marilyn Davis
On Fri, 20 Jan 2006, Python wrote: > On Fri, 2006-01-20 at 13:50 -0800, Marilyn Davis wrote: > > for each in significant_headers.keys(): > > this = '''self.h_%s = "%s"''' % \ > >(eac

Re: [Tutor] Quoting trouble

2006-01-20 Thread Marilyn Davis
On Fri, 20 Jan 2006, Kent Johnson wrote: Thank you so much Kent. This is *very* helpful. > Marilyn Davis wrote: > > Dear Tutors, > > > > I'm having a problem and going around in circles. I'm on Python 2.4.1. > > > > This odd address line come

[Tutor] Quoting trouble

2006-01-20 Thread Marilyn Davis
^ SyntaxError: invalid syntax So, how do I keep the \" in there? I've tried a bunch of things but can't find anything that works. Heeelp. Please. Thank you. Marilyn Davis ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] is this a bug global i ???

2005-06-14 Thread Marilyn Davis
j i = 11# changes the global i print i Hope this helps. I had the same confusion long ago and this list helped me. Marilyn Davis > > pujo > ___ > Tutor maillist - Tutor@python.org > http://mail

Re: [Tutor] Planning a program with algorithm?

2005-05-30 Thread Marilyn Davis
On Mon, 30 May 2005, . , wrote: > I'm learning python by reading 'Python Programming for the Absolute > Beginner' by Michael Dawson. > > And I'm doing chapter4. In the book it says it's recommended to plan a prog. > with pseudocode. > > Can i just ignore it? Yes! Python is a formalized pseud

Re: [Tutor] function runs w/o error but produces no output (?) - possible spoiler

2005-05-06 Thread Marilyn Davis
On Fri, 6 May 2005, D. Hartley wrote: > Hey guys, > > I wrote the following function, and if I do it line-by-line in the > interpreter, each line works exactly as it should. However, when I > run the function by its name, nothing happens. It doesnt print the > print statement, it doesnt give me

Re: [Tutor] inexplicable MySQLdb behavior, INSERT data doesn't appear

2005-04-19 Thread Marilyn Davis
urn did Hope it helps. Marilyn Davis > > Kent > > [EMAIL PROTECTED] wrote: > > hi all, while recently trying to insert some data into the following > > table: > > > > # stores unique course definitions > > CREATE TABLE adminCourses ( > > ID T

Re: [Tutor] str.split and quotes

2005-04-08 Thread Marilyn Davis
On Fri, 8 Apr 2005, C Smith wrote: > Tony wrote: > With Python 2.4 I get these results (all imports are factored > out, all give > the same result except for CSV which strips the "s) with > timeit.py: > > Just a note here in terms of results.  Although the results are all

Re: [Tutor] str.split and quotes

2005-04-08 Thread Marilyn Davis
On Fri, 8 Apr 2005, Kent Johnson wrote: > Marilyn Davis wrote: > > Is there a reason to prefer one over the other? Is one faster? I > > compiled my regular expression to make it quicker. > > The only way to know which is faster is to time them both. The timeit module >

RE: [Tutor] str.split and quotes

2005-04-07 Thread Marilyn Davis
On Fri, 8 Apr 2005, Tony Meyer wrote: > > Is there a reason to prefer one over the other? Is one > > faster? I compiled my regular expression to make it quicker. > > With Python 2.4 I get these results (all imports are factored out, all give > the same result except for CSV which strips the "s)

Re: [Tutor] str.split and quotes

2005-04-07 Thread Marilyn Davis
On Thu, 7 Apr 2005, Danny Yoo wrote: > > > On Wed, 6 Apr 2005, Kent Johnson wrote: > > > s = 'Hi "Python Tutors" please help' > > s.split() > > > > > > ['Hi', '"Python', 'Tutors"', 'please', 'help'] > > > > > > > > > I wish it would leave the stuff in quotes in tact: > > > > > > ['Hi',

RE: [Tutor] str.split and quotes

2005-04-06 Thread Marilyn Davis
ndall(r'\".*\"|[^ ]+', s) > ['Hi', '"Python Tutors"', 'please', 'help'] > > The regular expression says to find patterns that are either a quote (\") > then any number of any characters (.*)then a quote (/") or (|)

[Tutor] str.split and quotes

2005-04-05 Thread Marilyn Davis
> I wish it would leave the stuff in quotes in tact: ['Hi', '"Python Tutors"', 'please', 'help'] Any suggestions? Thank you. Marilyn Davis ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-04 Thread Marilyn Davis
On Sat, 5 Feb 2005, Alan Gauld wrote: > Marilyn, > > > I'll whisper that I'm a tiny bit disappointed to see the vaguely > > demeaning 'are you joking' theme that has emerged in here. It's > > unusual for us to be anything but generous and kind with each other. > > I guess this is a hot topic. :

RE: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-04 Thread Marilyn Davis
I think Danny was saying that if you don't like: if var == 'a': print 'a' elif var == 'b' or var == 'c': print 'b or c' elif var == 'd': pass else: print 'default case' you might like his dispatch scheme. And it has been mighty nice and handy for me since he taught me, in some specia

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-03 Thread Marilyn Davis
I once heard that Larry Wall said, "Perl is worse than Python because people needed it worse". And I've heard it said that "Perl is the Write-Only language" Marilyn ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] sockets, files, threads

2005-01-20 Thread Marilyn Davis
Danny! I couldn't resist trying threading again, now that the mysterious single-threading behavior is gone. I didn't put any locks anywhere. And it runs like a champ. Like a super champ. Either I had to put back threading or I had to make a family of socket-readers, or lose some functionality

Re: [Tutor] sockets, files, threads

2005-01-19 Thread Marilyn Davis
On Wed, 19 Jan 2005, Danny Yoo wrote: > On Wed, 19 Jan 2005, Marilyn Davis wrote: > > > class Exim: > > def __init__(self): > > self.fdin = None > > self.err_flush = [] > > self.stdout, self.stdin, self.stderr =

Re: [Tutor] sockets, files, threads

2005-01-19 Thread Marilyn Davis
Thank you Kent. On Wed, 19 Jan 2005, Kent Johnson wrote: > Marilyn Davis wrote: > >>few lines up, right where 'client_socket' is initialized. Like this: > >> > >>### > >>try: > >>client_socket, client_ad

Re: [Tutor] sockets, files, threads

2005-01-19 Thread Marilyn Davis
> > > What about when I do an explicit call to a close inside a __del__. Is > > that a bad idea? > > I usually prefer to add a close() method to my objects that releases > resources, rather than __del__(), because it's more visible. > OK Danny! I found it! When I was almost asleep last night

Re: [Tutor] sockets, files, threads

2005-01-18 Thread Marilyn Davis
Thank you so much Danny. I know how hard it is to look at and comment on other people's code. You know I teach C and Python and I have to say, though, that reading students' Python is 100 times easier than reading their C. And, I hope you're feeling better. I hate to think of you struggling thr

Re: [Tutor] sockets, files, threads

2005-01-16 Thread Marilyn Davis
On Sat, 15 Jan 2005, Danny Yoo wrote: > > > > I have only wrapped my lock around file-descriptor creations. Should I > > wrap it around closings too? Or the whole open -> close transaction? > > It sounds like error-prone work to do the latter. What am I missing? > > Hi Marilyn, > > Can you

Re: [Tutor] sockets, files, threads

2005-01-15 Thread Marilyn Davis
googling. Thank you. On Sat, 15 Jan 2005, Marilyn Davis wrote: > Dearest Tutors, > > Bah! It's not over yet. I don't know why, but again my file > descriptors are being trampled upon now and then. > > This time I can see in my log that I'm not trampling on them mysel

Re: [Tutor] sockets, files, threads

2005-01-15 Thread Marilyn Davis
Dearest Tutors, Bah! It's not over yet. I don't know why, but again my file descriptors are being trampled upon now and then. This time I can see in my log that I'm not trampling on them myself, like I used to do, unless I'm making calls to the system that I'm not aware of. And, first I get th

Re: [Tutor] sockets, files, threads

2005-01-15 Thread Marilyn Davis
Whew! What a trip this bug has been! Danny was exactly right here: > is exactly the sort of thing I'd expect if two threads were > contending for the same resource, so let's see if the bug has to do > with this. This bug drove me nuts. (it's a short drive) So I started wrapping my file open

Re: [Tutor] sockets, files, threads

2005-01-12 Thread Marilyn Davis
On Wed, 12 Jan 2005, Danny Yoo wrote: Thank you so much for thinking about this Danny. > > When stuff was read from the exim socket, it was stored in a tempfile, > > so that I could release the exim process, then I lseek to the front of > > the tempfile and have it handy. I see from all my debu

[Tutor] sockets, files, threads

2005-01-12 Thread Marilyn Davis
go through the entire process without a problem, and then # 6 hits this -- but only if # 1 message is really big. I'm at a loss. Does anyone have an idea? Marilyn Davis ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] flattening a list

2005-01-11 Thread Marilyn Davis
On Wed, 12 Jan 2005 [EMAIL PROTECTED] wrote: > Quoting Bill Kranec <[EMAIL PROTECTED]>: > > > I have a list of lists, for example [ [1,2] , [3,4] ], and I would like > > to pass all the elements of that list as arguments to a function (for > > example the intersection of all list elements). Is t

RE: [Tutor] Debugging in emacs

2004-12-26 Thread Marilyn Davis
now is that the Python buffer and my source code > keep switching places from top to bottom. A minor annoyance that > hopefully I will rectify soon. This doesn't happen to me. I am using regular ole raw emacs, on a plain terminal, no X. Are you? How are you doing with this? I could sure us

Re: [Tutor] tempfile

2004-12-24 Thread Marilyn Davis
On Fri, 24 Dec 2004, Kent Johnson wrote: > Marilyn Davis wrote: > > Hello Python Tutors, > > > > I'm using tempfile. The doc says it is opened 'w+b' so that it can be > > read and written without closing and reopening. > > > > But, for the

Re: [Tutor] Re: tempfile (fwd)

2004-12-23 Thread Marilyn Davis
And again. -- Forwarded message -- Date: Thu, 23 Dec 2004 14:55:15 -0800 (PST) From: Marilyn Davis <[EMAIL PROTECTED]> To: Lee Harr <[EMAIL PROTECTED]> Subject: Re: [Tutor] Re: tempfile os.lseek! How did I not find that. Thank you. I'm set. Marilyn On Fri,

Re: [Tutor] tempfile (fwd)

2004-12-23 Thread Marilyn Davis
Ooops. I forgot to send to the list. -- Forwarded message -- Date: Thu, 23 Dec 2004 14:53:18 -0800 (PST) From: Marilyn Davis <[EMAIL PROTECTED]> To: QoD SEC <[EMAIL PROTECTED]> Subject: Re: [Tutor] tempfile On Thu, 23 Dec 2004, QoD SEC wrote: > you could use the

[Tutor] tempfile

2004-12-23 Thread Marilyn Davis
. Is there a way to make a file object from a file descriptor? Or, is there something in os or fcntl that allows me to rewind from a file descriptor? Thank you for any help you can give. Marilyn Davis ___ Tutor maillist - Tutor@python.org http://mai

Re: [Tutor] What am I doing wrong...

2004-12-23 Thread Marilyn Davis
Hi Ken, Welcome to python! Adding one line should do it for you: On Thu, 23 Dec 2004, Ken Stevens wrote: > I am a elative new comer to python. I wrote the following test > snippet. > > #!/usr/bin/env python > > def main (): > play_test() > > def play_test (): > print "Hi! -- in play

Re: [Tutor] A little Tkinter question

2004-12-17 Thread Marilyn Davis
On Wed, 15 Dec 2004, Gregor Lingl wrote: > > > Marilyn Davis schrieb: > > Hi Tutors, > > > > I'm reviewing GUIs and wondering: > > > > When you pack a component, and you specify fill = BOTH, how is this > > different from expand = YES? >

[Tutor] A little Tkinter question

2004-12-15 Thread Marilyn Davis
Hi Tutors, I'm reviewing GUIs and wondering: When you pack a component, and you specify fill = BOTH, how is this different from expand = YES? Thank you for any insight. Marilyn Davis ___ Tutor maillist - [EMAIL PROTECTED] http://mail.pytho

Re: [Tutor] turning a number into a formated string

2004-12-15 Thread Marilyn Davis
On Wed, 15 Dec 2004, Tim Peters wrote: > ... return ("%09.4f" % n).replace('.', '') Totally cool. Marilyn ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] turning a number into a formated string

2004-12-15 Thread Marilyn Davis
Here's one way: left, right = str(number).split('.') output = "%04d%d" % (int(left), int(right)) + (4 - len(right)) * '0' Maybe someone has a more elegant way. Hope it helps, Marilyn Davis On Wed, 15 Dec 2004, Ertl, John wrote: > I need to take a numb

Re: [Tutor] eval and exec

2004-12-05 Thread Marilyn Davis
On Sun, 5 Dec 2004, Danny Yoo wrote: > > It pays to see a concrete example of an exploit that has occurred because > of exec/eval misuse. For example, here's an old one from July 2002: > > http://www.securityfocus.com/bid/5255/discussion/ > > Note that this one was in the Standard Library!

Re: [Tutor] eval and exec

2004-12-05 Thread Marilyn Davis
same open door? I love the exec() call. I love the idea of code that makes and execs code. I'll make myself obsolete. :^) Marilyn On Sun, 5 Dec 2004, Marilyn Davis wrote: > On Sat, 4 Dec 2004, Chad Crabtree wrote: > > > Marilyn Davis wrote: > > > > >Thank you.

Re: [Tutor] eval and exec

2004-12-05 Thread Marilyn Davis
On Sat, 4 Dec 2004, Chad Crabtree wrote: > Marilyn Davis wrote: > > >Thank you. You guys are great. > > > >I was trying to eval("import %s" % something). > > > >exec("import %s" % something) works just fine and now I understa

Re: [Tutor] eval and exec

2004-12-04 Thread Marilyn Davis
Thank you. You guys are great. I was trying to eval("import %s" % something). exec("import %s" % something) works just fine and now I understand why. But, why is this so extremely dangerous? Marilyn ___ Tutor maillist - [EMAIL PROTECTED] http

[Tutor] eval and exec

2004-12-03 Thread Marilyn Davis
Hello Tutors, I'm having trouble understanding the difference between eval and exec. Can anyone explain it to me please? Marilyn Davis -- ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Strange Appending

2004-12-02 Thread Marilyn Davis
t I understand your question because I don't see all the code and I don't know what you hope will happen. But ... append appends the object as a single element. Try self.a.extend(t) extend attaches the t list to the end of the list. Does this give you what you expect? Marilyn Davis