Re: Help with some python homework...

2014-01-31 Thread Scott W Dunning
= 60 discounted_price = (1-discount) * price_per_book shipping = 3.0 + (60 - 1) * .75 total_price = 60 * discounted_price + shipping print total_price, 'Total price' Scott On Jan 31, 2014, at 8:02 PM, Denis McMahon wrote: > On Thu, 30 Jan 2014 21:12:19 -0800, scottwd80 wrote: > >>

Re: Help with some python homework...

2014-02-01 Thread Scott W Dunning
Yeah you’re right I didn’t even notice that. For some reason I just added the 60 instead of using quantity which had been defined. On Feb 1, 2014, at 8:50 AM, Dennis Lee Bieber wrote: > On Fri, 31 Jan 2014 22:18:34 -0700, Scott W Dunning > declaimed the following: > >>

Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
: 11 how can I get it to print with no spaces? 3:11 I’m VERY new to python and coding in general and this is a question for a class I’m in for a test review. So, the most basic answer would be appreciated. Thanks for any help!! Scott -- https://mail.python.org/mailman/listinfo/python

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
at 12:22 PM, Scott W Dunning wrote: >> Assume variables exist for minutes and seconds. Each variable is an integer. >> How would you create a string in the format, >> >> 3:11 >> >> with no spaces. where 3 is minutes and 11 is seconds. >> >>

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
what exactly is the “%d:%02d”% saying? On Feb 6, 2014, at 6:25 PM, Roy Smith wrote: > In article , > Scott W Dunning wrote: > >> I am having trouble figuring out how to remove spacesŠ. >> >> Assume variables exist for minutes and seconds. Each variable is an

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
. Also, not really clear on the reasoning behind changing the int to a string? On Feb 6, 2014, at 9:45 PM, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 3:09 PM, Scott W Dunning wrote: >> Is this what you’re talking about? >> >> minutes = “3” >> seconds = “1

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
> > A few things that will make your communications more fruitful: > > * Please don't top-post. Trim the quoted material to the parts relevant > for your response, and respond inline like a normal discussion. Oh, ok sorry about that. Like this? > > * Ensure that your message composer does

Python 2.7.6 help with modules

2014-02-07 Thread Scott W Dunning
I have a question that was a part of my homework and I got it correct but the teacher urged me to do it using the % sign rather than subtracting everything, for some reason I’m having issues getting it to calculate correctly. I’ll put the question below, and what I originally had and below that

Re: Python 2.7.6 help with modules

2014-02-07 Thread Scott W Dunning
On Feb 7, 2014, at 10:10 PM, Chris Angelico wrote: > It might be easiest to think in terms of a single "divide into > quotient and remainder" operation. Let's leave aside > weeks/days/hours/minutes/seconds and split a number up into its > digits. (This is actually not as useless as you might thi

Re: Python 2.7.6 help with modules

2014-02-07 Thread Scott W Dunning
On Feb 7, 2014, at 10:10 PM, Chris Angelico wrote: > > You should be able to get this to the point of writing out five > separate values, which are the original five digits. Each one is worth > 10 of the previous value. At every step, do both halves of the > division. What do you mean by at ea

Re: Python 2.7.6 help with modules

2014-02-07 Thread Scott W Dunning
> > On Feb 7, 2014, at 10:10 PM, Chris Angelico wrote: >> >> number = int(raw_input("Enter a five-digit number: ")) >> >> Now we begin to split it up: >> >> foo = number % 10 >> bar = number / 10 >> Ok, so it this what you’re talking about? number = int(raw_input(“Enter a five digit number:

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
s has never yet > happened. But for this, we're working in a system that has seconds > going from 00 to 59 I honestly do not know what leap seconds are but I’ll take your word for it. lol Thanks again!!! Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
#x27;, seconds, 'seconds' Not sure if that’s the correct way to do it but it works! If there is any other advice I’ll take it. On Feb 7, 2014, at 11:29 PM, Chris Angelico wrote: > On Sat, Feb 8, 2014 at 5:27 PM, Scott W Dunning wrote: >> Ok, so it this what you’re

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 7, 2014, at 11:29 PM, Chris Angelico wrote > Close! But if you print out foo and bar, you'll see that you're naming > them backwards in the second one. The last digit is the remainder > (modulo), the rest is the quotient. So, this is more like what you’re talking about? >>> first = numbe

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 8, 2014, at 6:46 PM, Chris Angelico wrote: > No, I'm not a teacher by profession, but I was homeschooled, and since > I'm the second of seven children [1], I got used to teaching things to > my siblings. Also, every week I run a Dungeons and Dragons campaign > online, which requires simila

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 8, 2014, at 6:46 PM, Chris Angelico wrote: > That's certainly effective. It's going to give you the right result. I > would be inclined to start from the small end and strip off the > seconds first, then the minutes, etc, because then you're working with > smaller divisors (60, 60, 24, 7 i

Re: Python 2.7.6 help with modules

2014-02-09 Thread Scott W Dunning
On Feb 8, 2014, at 11:30 PM, Chris Angelico wrote: I have one more question on this if you don’t mind. I’m a bit confused on how it works this way without it being in seconds? I’ll answer below each step of how it seems to work to me. > How to do it from the small end up: > > time = int(ra

Re: Python 2.7.6 help with modules

2014-02-09 Thread Scott W Dunning
e /= 7 > weeks = time I guess I answered my own question and it looks like it wouldn’t matter if you did it opposite from weeks to seconds. Thanks again for all your help everyone! Scott -- https://mail.python.org/mailman/listinfo/python-list

Simple % question

2014-02-11 Thread Scott W Dunning
I just have a simple question. I don’t understand why 1%10 = 1? -- https://mail.python.org/mailman/listinfo/python-list

Re: Simple % question

2014-02-11 Thread Scott W Dunning
On Feb 11, 2014, at 6:51 PM, Christopher Welborn wrote: > I think because 1 is evenly divisible by 10 exactly 0 times with a 1 > remainder. I mean int(1 / 10) == 0, with a 1 remainder. > The same is true for all numbers leading up to 10. > Actually I think I get it now. I think I was not really

Re: Simple % question

2014-02-11 Thread Scott W Dunning
On Feb 11, 2014, at 6:36 PM, Chris Angelico wrote: > > The real question is: What do you expect that symbol to mean? > > Its actual meaning is quite simple. In long division, dividing one > number by another looks like this: Yeah I understand what the % means. It just confused me that 1%10 was

Re: Function and turtle help

2014-02-20 Thread Scott W Dunning
On Feb 20, 2014, at 9:41 PM, Scott W Dunning wrote: > Hello, > > I am trying to make a function that allows me to color in a star that was > drawn in Turtle. I just keep having trouble no matter what I do. I’ll post > the code I have for the star (just in case). The ulti

Function and turtle help

2014-02-20 Thread Scott W Dunning
this piece by piece in class. So, I need to create a function that will color in the star that I can call multiple times for each star. Any help is greatly appreciated! Scott from turtle import * from math import sin, sqrt, radians showturtle() def star(width): R = (width)/2*sin(radians(72

Re: Function and turtle help

2014-02-21 Thread Scott W Dunning
to fill it in with red. So I’m obviously messing up somewhere. def fillcolor(red): pencolor() begin_fill() star(500) end_fill() red = pencolor fillcolor(red) Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Function and turtle help

2014-02-21 Thread Scott W Dunning
On Feb 21, 2014, at 7:13 PM, Dave Angel wrote: > Scott W Dunning Wrote in message: >> >> On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: >> >>> Look at turtle.begin_fill and turtle.end_fill >>> >>> That's after making sure your star is a

Re: Function and turtle help

2014-02-22 Thread Scott W Dunning
On Feb 21, 2014, at 9:30 PM, Dave Angel wrote: You’re awesome David! Thanks for taking the time to not only help answer my question but helping me to understand it as well!! Scott -- https://mail.python.org/mailman/listinfo/python-list

Functions help

2014-02-22 Thread Scott W Dunning
Hello, I had a question regarding functions. Is there a way to call a function multiple times without recalling it over and over. Meaning is there a way I can call a function and then add *5 or something like that? Thanks for any help! Scott -- https://mail.python.org/mailman/listinfo

Re: Functions help

2014-02-23 Thread Scott W Dunning
On Feb 23, 2014, at 1:44 AM, Steven D'Aprano wrote: > > Sorry, I don't really understand your question. Could you show an example > of what you are doing? > > Do you mean "add 5" or "*5"? "Add *5 doesn't really mean anything to me. Sorry I forgot to add the code that I had to give an example

Re: Functions help

2014-02-23 Thread Scott W Dunning
On Feb 23, 2014, at 12:59 AM, Ben Finney wrote: > > You should ask question like this on the “python-tutor” forum. Thanks Ben, I wasn’t aware of PythonTutor. -- https://mail.python.org/mailman/listinfo/python-list

Re: Functions help

2014-02-23 Thread Scott W Dunning
I understood what you meant because I looked up loops in the python documentation since we haven’t got there yet in school. On Feb 23, 2014, at 6:39 PM, alex23 wrote: > On 24/02/2014 11:09 AM, Mark Lawrence wrote: >> On 24/02/2014 00:55, alex23 wrote: >>> >>> for _ in range(5): >>> f

Help with "Guess the number" script

2014-02-28 Thread Scott W Dunning
Hello, i am working on a project for learning python and I’m stuck. The directions are confusing me. Please keep in mind I’m very ne to this. The directions are long so I’ll just add the paragraphs I’m confused about and my code if someone could help me out I’d greatly appreciate it! Also, w

Re: Help with "Guess the number" script

2014-03-01 Thread Scott W Dunning
On Mar 1, 2014, at 11:03 AM, Susan Aldridge wrote: > Try this > > def guess1(upLimit = 100): >import random >num = random.randint(1,upLimit) >count = 0 >gotIt = False >while (not gotIt): >print('Guess a number between 1 and', upLimit, ':') >guess= int(input())

Re: Help with "Guess the number" script

2014-03-01 Thread Scott W Dunning
On Mar 1, 2014, at 9:35 AM, Dennis Lee Bieber wrote: > Without loops, one part of your assignment is going to be tedious, > unless the intent is to only allow for one guess per run. No, 10 guesses per game. Yes very tedious and repetative. > >> from random import randrange >> randrange(1,

Re: Help with "Guess the number" script

2014-03-02 Thread Scott W Dunning
I get past this first par I’ll be good to go. Hopefully! Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with "Guess the number" script

2014-03-02 Thread Scott W Dunning
ion. So it's correspondingly more useful to > learn Py3.) > > ChrisA I completely agree. However, the instructor is wanting to use Python 2.7.6 because the book he is using for the course goes over 2.7.6. Hopefully, once I learn more it will not be a huge jump to python 3. Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with "Guess the number" script

2014-03-02 Thread Scott W Dunning
On Mar 2, 2014, at 6:40 PM, Scott W Dunning wrote: This is what Im having trouble with now. Here are the directions I’m stuck on and what I have so far, I’ll bold the part that’s dealing with the instructions if anyone could help me figure out where I’m going wrong. Thanks! from random

Re: Help with "Guess the number" script

2014-03-02 Thread Scott W Dunning
On Mar 2, 2014, at 8:52 PM, Ben Finney wrote: > > Once again, Scott, this discussion should be happening at the Tutor > forum. Please don't continue the fragmentation of this discussion; keep > the discusson over at the Tutor forum. Sorry, I was just replying to replies to my

Re: Function and turtle help

2014-03-07 Thread Scott W Dunning
//code.google.com/p/pynguin/wiki/StartProgramming > Awesome! Looks fun, I’ll definitely check it out and let you know!! Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug in python (Weird UnicodeDecodeError)

2005-12-13 Thread Scott David Daniels
n help you. I suspect that "position" is more like a Unicode data point than the position within the string you are feeding. Show us the code doing the translation and the data it is being fed, and we can help. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: openings on java with japanese language

2005-12-14 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > send your profile to [EMAIL PROTECTED] Please don't post job offers here (comp.lang.python) (even for Python jobs), there are more appropriate places for Python jobs, but there is no excuse for asking for Java programmers here. --Scott David Daniels [EMAIL P

Re: How to get the local mac address?

2005-12-14 Thread Scott David Daniels
replacestr = 'x' > macaddr = ''.join([macaddr, hex(intval).replace(replacestr, '')]) Replace the above by: return '%02X' * 6 % struct.unpack('BB', buffer) (doesn't help with win98, though) -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python packages on OS X vs Windows

2005-12-14 Thread Scott David Daniels
cessor; this comes from allowing flexibility to individual programs. The Windows model is big programs that do everything; the *ix model is small independent processes that connect in interesting ways. I like the latter, but there is something to be said for the former. --Scott David Daniels [EMAI

Re: Problem with os.path

2005-12-16 Thread Scott David Daniels
/marketdata/da' even on windows. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE

2005-12-16 Thread Scott David Daniels
with Komodo. Getting the updates w/o extra charge was a bonus. I was happy with the deal on the original version, so these further improvements just make my deal feel better. I don't regularly use Komodo, but when I do want it, it is invaluable. My only affiliation with ActiveState is as a c

Re: to write set of values to a file from python

2005-12-16 Thread Scott David Daniels
revious, True file = open ('C:\some.csv','r') reader = csv.reader(file) for row, final in lagged(reader): print row if final: print 'final:', row else: print 'leads:', row --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: access to preallocated block of memory?

2005-12-16 Thread Scott David Daniels
You might want to take a look at the "Blocks and Views" code I did, take a look at it and see if you can either use it directly or use it with any changes you feel like making. http://members.dsl-only.net/~daniels/Block.html -- -Scott David Daniels [EMAIL PROTECTED

Re: to write set of values to a file from python

2005-12-16 Thread Scott David Daniels
Scott David Daniels wrote: > > def lagged(source): > '''produce element,islast for elements in source''' > generator = iter(source) > previous = generator.next() > for element in generator: > y

Double-Ended Heaps

2005-12-18 Thread Scott David Daniels
I've just put together a Double-Ended Heap package. Of course I'd love comments. http://members.dsl-only.net/~daniels/deheap.html --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Double-Ended Heaps

2005-12-18 Thread Scott David Daniels
pare as equal, so the DeHeap2 operations that > find items by value will be at least under-defined, and maybe > even broken. Actually, the issue already exists for elements which define their own __lt__ function. The rule I will use is that you have told the DeHeap to delete some member equal

Re: Double-Ended Heaps

2005-12-19 Thread Scott David Daniels
Bryan Olson wrote: > Scott David Daniels wrote: >> I've just put together a Double-Ended Heap package. >> Of course I'd love comments. >> >>http://members.dsl-only.net/~daniels/deheap.html > > I think there's a typo in: > >

Re: Which Python web framework is most like Ruby on Rails?

2005-12-19 Thread Scott David Daniels
a you've obtained. If you don't get transaction guarantees, your applications will have to deal with all kinds of inconsistent data (either by ignoring the problem or guessing the best answer). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Python web framework is most like Ruby on Rails?

2005-12-19 Thread Scott David Daniels
Alex Martelli wrote: > Scott David Daniels <[EMAIL PROTECTED]> wrote: >> If the data you store and update is sufficiently valuable to your >> enterprise, picking a database may be vital. Transactions guarantee >> every update either happens or not, and infrastructure i

Re: Parsing text

2005-12-20 Thread Scott David Daniels
f line.endswith('Person: Sarah\n'): dest = person_sarah else: continue while line != '---\n': dest.write(line) line = source.next() f.close() person_jimmy.close() person_sarah.close() --

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Scott David Daniels
ing. You state that the code is > (for example) triple-licensed under the GPL, LGPL and BSD licenses. One lawyer I talked to (who could not understand why I wanted to open-source any code), claimed that the MIT license is better written (legally) to protect the author from acquiring legal l

Re: Please enlighten me about PyPy

2005-12-22 Thread Scott David Daniels
loding heads here). The big trick is that you can specialize the interpreter for running _its_ input (a Python program), thus giving you a new interpreter that only runs your Python program -- a very specialized interpreter indeed. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org

Re: Providing 'default' value with raw_input()?

2005-12-23 Thread Scott David Daniels
y a WinXX example, but the "-n" parameter to idle is the important part. Since a single-process Idle is running the Tkinter GUI loop, you can try operations a step at a time (letting you see what happens). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-26 Thread Scott David Daniels
the > syntactic colorizer can't cope any more. > > I definitively need a new algorythm. > And I am sadly stuck at 169. Not even spitting distance from 149 (which sounds like a non-cheat version). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: help with lists and writing to file in correct order

2005-12-26 Thread Scott David Daniels
append each to its own list, and then either finally if you can or periodically if you must: for food, store, price in zip(foods, stores, prices): -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a refrence issue?

2005-12-29 Thread Scott David Daniels
KraftDiner wrote: > I have a list and want to make a copy of it and add an element > to the end of the new list, but keep the original intact Nobody has mentioned the obvious yet: tmp = myList + [something] --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/m

Re: Vector math library

2005-12-31 Thread Scott David Daniels
o do vector > addition, cross products, dot products etc. and probably in the future > I'll need matrix math as well. > Take a quick look at VPython. Should be great for breadboarding your display and calculations. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: advanced module/import/namespace idioms

2005-12-31 Thread Scott David Daniels
ltin__ module is magical -- the source of predefined names. _Do_not_muck_about_with_it_in_delivered_code_ (I know it is tempting). The reason to avoid playing with it is that you are slightly breaking the Python environment all code runs in. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing control characters from entering an XML file

2006-01-01 Thread Scott David Daniels
ng those > characters out? drop_controls = [None] * 0x20 for c in '\t\r\n': drop_controls[c] = unichr(c) ... some_unicode_string = some_unicode_string.translate(drop_controls) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Hypergeometric distribution

2006-01-01 Thread Scott David Daniels
if you still need to speed it up: def bincoeff2(n, r, cache={}): if r < n - r: r = n - r try: return cache[n, r] except KeyError: pass x = 1 for i in range(n, r, -1): x *= i for i in range(n - r, 1, -1): x /= i cache[n, r] = x return x --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Hypergeometric distribution

2006-01-02 Thread Scott David Daniels
s under-estimate of needed repetitions while t0.timeit(repetitions) < .25: # .25 = minimum Secs per round repetitions *= 10 print 'Going for %s repetitions' % repetitions print 'hypergeometric:', t0.repeat(3, repetitions) print 'hypergeomet

Re: About zipfile on WinXP

2006-01-02 Thread Scott David Daniels
;original.zip', 'rb') copy = open('copy.zip', 'wb') copy.write(original.read()) original.close() copy.close() 3) Now see if copy.zip can be opened by clicking. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread Scott David Daniels
namically bound systems like Smalltalk, Ruby, and Python, the more unusual case is wanting to go up the hierarchy (where you use super to get the behavior you are apparently expecting). Think of Python's method dispatch as always being "virtual". --Scott David Daniels [E

Re: Filename case-insensitivity on OS X

2006-01-03 Thread Scott David Daniels
Tom Anderson wrote: > Java has a java.io.File.getCanonicalPath method that does this, but i > can't find an equivalent in python - is there one? What's wrong with: os.path.normcase(path) ? --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4 - Help does not work in Windows

2006-01-04 Thread Scott David Daniels
s) - names)) '_random binascii collections dis errno imp inspect opcode pydoc random tempfile thread token tokenize' That is, those are the modules loaded in the course of doing the "help". I'd try loading them one-by one. Alternatively, start the interpreter as: python -v And watch the imports as you do (1) "import time", and (2) "help(time)". You may see the import causing the problem. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-04 Thread Scott David Daniels
KraftDiner wrote: > Have I misunderstood something? yes. There is a reason people talk about names and bindings. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading for a newbie

2006-01-05 Thread Scott David Daniels
rvers are done. else: # We got a result. print '%s: %s' % (time.time() - base, result) if __name__ == "__main__": main(3) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing control characters from entering an XML file

2006-01-05 Thread Scott David Daniels
Frank Niessink wrote: > Scott David Daniels wrote: >> Frank Niessink wrote: >>> - What is the easiest/most pythonic (preferably build-in) way of >>> checking a unicode string for control characters and weeding those >>> characters out? >> drop_contr

Re: pdb.py - why is this debugger different from all other debuggers?

2006-01-05 Thread Scott David Daniels
t this ability. Pretty swift, ehhh? I have no relationship to ActiveState except as a happy customer. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance problem?

2006-01-06 Thread Scott David Daniels
f __init__(self): > # super(self.__class__, self).__init__() super(Square, self).__init__()# XXX fixed > self.type = Square > print 'Square' > > r = Rectangle() > s = Square() > -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Spelling mistakes!

2006-01-07 Thread Scott David Daniels
s like "bkg_clr" too. Yeah, it's a real pain to constantly type "breakage_clear" every time. :-) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Double Click mouse event problems

2006-01-07 Thread Scott David Daniels
he above algorithm), you could specify 254 different values with a mouse and paddle-board. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I use socket.ssl in python

2006-01-08 Thread Scott David Daniels
to imagine answering what you just asked with the evidence you provided. I don't know if you are writing in Jython, IronPython, CPython, ... on a dingleblat 4000, running python 2.1.35? ... --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: MVC programming with python (newbie) - please help

2006-01-08 Thread Scott David Daniels
has wrote: > MVC is all about separation of concerns This is a wonderful explanation of MVC. I'm going to keep a link to the Google-Groups version just so I can cite it to those asking about MVC. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Failing unittest Test cases

2006-01-09 Thread Scott David Daniels
ot;) def test_three(self): ... @broken_test_XXX("Using list as dictionary", TypeError) def test_four(self): ... It would also point out when the test started succeeding. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: MVC in wxPython HELP!

2006-01-11 Thread Scott David Daniels
riptions of the MVC pattern and why it works. The link I have is huge, but: http://groups.google.com/group/comp.lang.python/browse_thread/ thread/eb0be1531e010273/ 9b80e79d4706200d?tvc=2&q=MVC+daniels#9b80e79d4706200d I've inserted returns at two points in the url directl

Re: Failing unittest Test cases

2006-01-12 Thread Scott David Daniels
last_class = class_name print ' %s\t %s' % (test_name, reason) Thanks for the thoughtful feedback. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Failing unittest Test cases

2006-01-12 Thread Scott David Daniels
that forum or this one): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466288 --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: how do "real" python programmers work?

2006-01-13 Thread Scott David Daniels
that often left me with too few test cases. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Scott David Daniels
e where you had more ink. So for such things, the "state" of an object is more than simply the rich detail of a data structure. Much more common are objects which communicate with other systems (either over network connections or locally on the machine). The point where a "value"

Re: zipfile decompress problems

2006-01-19 Thread Scott David Daniels
ve, -(22 + ignoreable), -20) coredata = cStringIO.StringIO(data[: 22 + position]) return zipfile.ZipFile(coredata) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: building strings from variables

2006-10-05 Thread Scott David Daniels
t; % ( working_dir, ssh_cmd, > some_count, some_param1, some_param2) ... Or another for readability: 4. some_string = ' '.join(["cd", working_dir, ";", ssh_cmd, str(some_count), some_param1, some_param2]) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Resuming a program's execution after correcting error

2006-10-05 Thread Scott David Daniels
ike even more than python itself) that > allows you to continue the work right where the exception was thrown. As I have explained before in this newsgroup, Xerox Parc had that ability (the ability to finish an exception by returning to its source) in their system implementation language, and f

Re: Graph Theory

2006-10-05 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Are there any visualization tool which would depict the random graph > generated by the libraries. Google for DOT (.DOT format w/ renders to a variety of output formats). -- --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/

Re: extract certain values from file with re

2006-10-06 Thread Scott David Daniels
use re unless it is a good solution. sometimes you know which columns things are in, sometimes you know a separator, sometimes there is a mix, and sometimes you do need a regular expression. Save re for when you need to do pattern matching. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: switching to numpy and failing, a user story

2006-10-06 Thread Scott David Daniels
27;t be so high as to make each of the programmer's customers pay as if they are using the full library. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Names changed to protect the guilty

2006-10-07 Thread Scott David Daniels
m for nm in dir(__builtin__) if nm.startswith('is') or nm.startswith('has')) ['hasattr', 'hash', 'isinstance', 'issubclass'] >>> [hasattr(type,'mro'), hash(123), isinstance(type, type), issubc

Re: A critique of cgi.escape

2006-10-08 Thread Scott David Daniels
;" : "\\\"", "\t" : "\\t", "\n" : "\\n"} def JSString(Str) : mapped = [_map.get(Ch, Ch) for Ch in Str] return "\"" + "".join(mapped) + "\"" -- --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: 3D Vector Type Line-Drawing Program

2006-10-09 Thread Scott David Daniels
ransparent surfaces (or maybe semitransparent). Take a look at VPython -- easy to start, 3-D display (wall-eye / cross-eye) easy to run on. -- --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: 3D Vector Type Line-Drawing Program

2006-10-11 Thread Scott David Daniels
Ron Adam wrote: > Scott David Daniels wrote: >> James Stroud wrote: >>>> I'm looking for a program to do line-drawings in 3d, with output to >>>> postscript or svg or pdf, etc. I would like to describe a scene with >>>> certain 1-3d el

Re: prefix search on a large file

2006-10-12 Thread Scott David Daniels
Try: def leaders(sorted_list): held = None for phrase in held: if held is None or not phrase.startswith(held): held = row yield held print list(leaders(sorted(data))) --Scott David Daniels [EMAIL PROTECTED] -- http

Re: prefix search on a large file

2006-10-12 Thread Scott David Daniels
Tim Chase wrote: >> def leaders(sorted_list): >> held = None >> for phrase in held: > ... I suspect you mean > for phrase in sorted_list: > no? Ooops -- renaming code before posting should get its own test. You are absolutely correct. -

Re: IDLE won't run

2006-10-12 Thread Scott David Daniels
:\Python25\pythonw.exe" to: "C:\Python25\pythonw.exe -m idlelib.idle -n" If this shortcut works to give you Idle, the problem is in creating a separate process linked via a socket to "localhost" port 8833. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: 3D Vector Type Line-Drawing Program

2006-10-12 Thread Scott David Daniels
Ron Adam wrote: > Scott David Daniels wrote: >> Ron Adam wrote: >>> ... Is there a way to have the display show a wire frame image instead of >>> shaded shapes? >> You can draw the edges as lines. > > Is there a setting for this?, or are you suggesting

Re: Loops Control with Python

2006-10-13 Thread Scott David Daniels
on't know about break, continue, and for ... else, go study the Python language. -- --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: sufficiently pythonic code for testing type of function

2006-10-13 Thread Scott David Daniels
Bruno Desthuilliers wrote: > ... idempotent -> no side effects. Nope. idempotent: f(f(x)) = f(x) That is, after doing it once, repeating it won't hurt. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I set up a timed callback without Tkinter or twisted or something?

2006-10-14 Thread Scott David Daniels
its not a GUI app. Use a thread that uses something like: def action(): sleep(50) if not canceled: callback(foo) as its action. The callback ill be in another thread, but Look up threading for more details. --Scott David Daniels [EMAIL PROTECTED] -

<    5   6   7   8   9   10   11   12   13   14   >