improve this newbie code/nested functions in Python?

2009-03-19 Thread Esmail
ython - is that correct? And if so, how come? thanks, Esmail ps: I realize there is minimal error checking/exception handling. #!/usr/bin/env python import sys from socket import * from threading import Thread class Client(object): def __init__(self, host="localhost",

Re: improve this newbie code/nested functions in Python?

2009-03-20 Thread Esmail
the two threads communicate with each other and know when to shut down. This feedback is exactly the sort of thing I was looking for, thanks, I'm looking forward to more suggestions. Esmail -- http://mail.python.org/mailman/listinfo/python-list

nested classes

2009-03-20 Thread Esmail
s rather nested classes - it was late) I asked something similar in the context of a specific example where I think the use of nested classes makes sense. But perhaps not? Esmail -- http://mail.python.org/mailman/listinfo/python-list

meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Esmail
h it, would you share it? Thanks. Esmail ps: primarily in Windows these days, though I have Ubuntu on a VM available too frequently. pps: I realize this is somewhat OT, but since this is what I'm interested in reading, and didn't know where else to post, the messa

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Esmail
I'd almost like to think there are a bunch of nice python programs out there that to this :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Esmail
Thank you Mark and Albert, exactly the sort of information I was looking for. Cheers, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: improve this newbie code/nested functions in Python?

2009-03-20 Thread Esmail
On Mar 20, 2:02 pm, [email protected] wrote: > On Mar 19, 10:21 pm, Esmail wrote: > > > > > Hi, > > > I'm new to writing Python code. This is a simple client I wrote, it > > works, but I feel it doesn't look as clean as it could. Can anyone >

Re: nested classes

2009-03-20 Thread Esmail
On Mar 20, 2:41 pm, Chris Rebert wrote: > 2009/3/20 Benjamin Kaplan : > > > > > > > On Fri, Mar 20, 2009 at 10:06 AM, Esmail wrote: > > >> Hello all, > > >> I am curious why nested classes don't seem to be used much in Python. > >>

Re: nested classes

2009-03-20 Thread Esmail
On Mar 20, 2:35 pm, Steve Holden wrote: > Benjamin Kaplan wrote: > > > On Fri, Mar 20, 2009 at 10:06 AM, Esmail > <mailto:[email protected]>> wrote: > > >     Hello all, > > >     I am curious why nested classes don't seem to be used much

Re: nested classes

2009-03-20 Thread Esmail
> Yes. It's the same convention used to indicate that a method is > "private" in Python, since the language itself has no privacy > mechanisms. Great - got it! Thanks again, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: improve this newbie code/nested functions in Python?

2009-03-20 Thread Esmail
e surrounding context. Thanks Terry, you've gotten me something to ponder. Regards, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Esmail
from gmail and g-groups. gmane mirrors 1000s of other technical mailing lists, including about 200 under g.c.python. I think its downtime is under 1% and never terribly long that I have noticed in several years. Thanks Terry, I appreciate all the help and info. Esmail -- http://mail.python.org

Re: improve this newbie code/nested functions in Python?

2009-03-21 Thread Esmail
class.. but perhaps that's a little too advanced. Hi Paul, Yes that was very helpful -- I'm glad I found this group :-) Best, Esmail -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
short. Any comments/suggestions? Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

R6034 -- 0.9.1 -- problems installing under XP

2009-03-21 Thread Esmail
tually end up with this: *** run_installscript: internal error 0x *** I've seen this error reported before while searching the web, so I know I'm not the only one who has run into this problem, but not seen any solutions. Can anyone help? Thanks, Esmail -- http://mail.python.

(SORRY .. )Re: R6034 -- 0.9.1 -- problems installing under XP

2009-03-21 Thread Esmail
Argh .. sorry about this post I was trying to post to gmane.comp.python.ipython.user (but it's not working), this was an accident - I didn't mean to send it here (wrong screen). Sorry about this..... Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Aahz wrote: In article , Esmail wrote: I am wondering if anyone is using python to write script files? These days, I always convert any even slightly complicated script to Python. well .. that sounds encouraging ... I've looked around the web w/o much luck for some examples but

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
ets a bit longer I miss having cleaner control structures and functions, and Python having such a clean code would be great and make maintenance easier too as I tweak the code. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
of an idea :-) Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Peter Pearson wrote: On Sat, 21 Mar 2009 09:26:02 -0400, Esmail wrote: I am wondering if anyone is using python to write script files? If it can be done in a few simple lines of shell script, fine: make it a shell script. But if it's more complex than that, Python is clearer. Just m

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
Ned Deily wrote: Perhaps the recipe for Pyline might give you some ideas on how to write python scripts that play well with other scripts. ah .. very nice .. thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Esmail
andrew cooke wrote: Esmail wrote: just a quick data point here - <..> so you might be better spending the time improving your bash skills than doing what will be largely drudge work in a language you already know. I'll have to think about it .. at this point I know both lang

Re: script files with python (instead of tcsh/bash)?

2009-03-22 Thread Esmail
Nick Craig-Wood wrote: Esmail wrote: I am wondering if anyone is using python to write script files? Yes! <..> Almost any script that contains a loop I convert into python. In any case, the scripts are starting to look pretty hairy and I was wondering if it would make sense

Re: script files with python (instead of tcsh/bash)?

2009-03-23 Thread Esmail
Python, the more I like it and the more I'm impressed. (I do miss bock comments, when you are trying out new things that is useful .. I know I can use """ as a substitute though). Thanks again, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: script files with python (instead of tcsh/bash)?

2009-03-23 Thread Esmail
Hi Gabriel, Gabriel Genellina wrote: En Sun, 22 Mar 2009 11:05:22 -0300, MRAB escribió: Esmail wrote: Nick Craig-Wood wrote: Esmail wrote: <..> As a replacement for grep I would use the re module and its methods? Perhaps; but strings have methods too (`"abc" in li

Re: script files with python (instead of tcsh/bash)?

2009-03-23 Thread Esmail
ss piping with python as with shell because it has almost everything you'll need built in. Using built in functions is much quicker than fork()-ing an external command too. Thanks again for all the useful info and examples, this really has been a great help. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: loading program's global variables in ipython

2009-03-23 Thread Esmail
Peter Otten wrote: Use %run -i myfile.py or execfile("myfile.py") # not ipython-specific thanks for these suggestions Peter, I have had exactly the same problem and was looking for a way around it -- this will be very helpful. Esmail ps: for some reason I am unable to p

Re: script files with python (instead of tcsh/bash)?

2009-03-23 Thread Esmail
Alan G Isaac wrote: On 3/21/2009 9:26 AM Esmail apparently wrote: I also write out some gnuplot scripts that later get executed to generate .jpg images. See Gnuplot.py Thanks Alan, I will! Esmail -- http://mail.python.org/mailman/listinfo/python-list

iPython 0.9.1 install under XP -- R6034

2009-03-24 Thread Esmail
seen this error reported before while searching the web, so I know I'm not the only one who has run into this problem, but not seen any solutions. Can anyone help? Thanks, Esmail PS: I see a ipython users group, but I have been unable to post to it despite trying for the last few days.

Re: iPython 0.9.1 install under XP -- R6034

2009-03-24 Thread Esmail
it seems to have worked, but I don't think it created any of the .bat files or entries in the startup menu etc. .. any idea how to those parts set up? Also, how did you know about the bdist_wininst command line argument? I looked around for this sort of information, but must have missed it.

Re: script files with python (instead of tcsh/bash)?

2009-03-25 Thread Esmail
Hello David, R. David Murray wrote: Esmail wrote: Here's a more Pythonic way to do that: with open('somefile') as f: for line in f: if 'somestring' in line: #do something In other words, you don't have to read the line

Re: script files with python (instead of tcsh/bash)?

2009-03-25 Thread Esmail
_line = None for line in f: if "somestring" in line and last_line is not None: # do something with last_line last_line = line Peter yup .. this will come in handy in case the file is too big and or really needn't be all in memory. cool. thanks! Esmail -- ht

Programming Python 4th Edition?

2009-03-26 Thread Esmail
book might be :-) Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming Python 4th Edition?

2009-03-27 Thread Esmail
e for this). It's good to hear what others think about this book, and others too. Cheers, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming Python 4th Edition?

2009-03-30 Thread Esmail
nk. I had a 40% off coupon for our local Borders, so I couldn't pass that up to get myself a copy of this book. No regrets. Cheers, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: python needs leaning stuff from other language

2009-04-02 Thread Esmail
Diez B. Roggisch wrote: [email protected] schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] I agree that this is nice and clear, but as a relative newbie wouldn't some_list = [] be also acceptable (and pythonic?)? -- http://mail.python.org/

Re: python needs leaning stuff from other language

2009-04-02 Thread Esmail
Emile van Sebille wrote: Esmail wrote: Diez B. Roggisch wrote: [email protected] schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] I agree that this is nice and clear, but as a relative newbie wouldn't some_list = [] This is

genetic algorithms in Python?

2009-04-08 Thread Esmail
Hello, Anyone using Python for coding up genetic algorithms? If so, would you share your favorite modules/libraries/tools? Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: genetic algorithms in Python??

2009-04-08 Thread Esmail
Hello Mohammed, Yes, that would great. While I am comfortable with GAs, I'm still rather inexperienced with Python so seeing some implementation examples would be very useful. Thanks, Esmail -- Date: Wed, 8 Apr 2009 17:08:48 +0200 Subject: Re: genetic algorithms in Python? From: me

Re: genetic algorithms in Python??

2009-04-08 Thread Esmail
R. David Murray wrote: Esmail wrote: Hello Mohammed, Yes, that would great. While I am comfortable with GAs, I'm still rather inexperienced with Python so seeing some implementation examples would be very useful. A google for 'python genetic algorithms' turns up a number of i

Re: genetic algorithms in Python?

2009-04-08 Thread Esmail
Terry Reedy wrote: Esmail wrote: Hello, Anyone using Python for coding up genetic algorithms? If so, would you share your favorite modules/libraries/tools? Search 'Python genetic algorithm' on Google or elsewhere. Hi Terry, I did that first, and I came up with a number of

is this possible (getting info off web page)

2009-04-09 Thread Esmail
telling me that kayak doesn't like bots. So, it seems like Kayak has it set up to prevent automated access? Is there anyway to do what I would like to do? Thanks, Esmail -- import urllib2 url = 'http://www.kayak.com/s/search/air?l1=cmh&d1=4/23/2009&l2=yyz&d2=4/26/2009&

Re: Request For Comment

2009-04-10 Thread Esmail
Aahz wrote: How RFC1 got created: http://www.nytimes.com/2009/04/07/opinion/07crocker.html That was great, thanks for posting the link. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: is this possible (getting info off web page)

2009-04-10 Thread Esmail
bruce wrote: Hi Esmail. I've not looked at the site. however, i can give you some general pointers that might help you in solving your issue. Excellent advice, thanks for pointing me in those directions. I am not familiar with curl but will take this as an opportunty to learn about

Re: Startup with Python

2009-04-11 Thread Esmail
whole path in the command window? For instance I have version 2.6 installed, so I can type c:\Python26\python.exe script.py to get this to work. Good luck, Esmail ps: try renaming the .py extension to .pyw and then double click it (should have worked before too - as far as I know this only

Re: How to check if a list contains an item

2009-04-12 Thread Esmail
[email protected] wrote: python doesn't have a list.contains() method? How about the 'in' operator? In [1]: l1=['aa', 'bb', 'cc'] In [2]: 'aa' in l1 Out[2]: True In [3]: 'ab' in l1 Out[3]: False I

Re: Calling user defined functions from a different script..

2009-04-15 Thread Esmail
I think taking a look at sys.path.append() might help. Esmail [email protected] wrote: Hello all, I have a situation where I need to call functions present in a different script whose hierarchy is something like below: C:\Pythonlib\uitl\script1.py {Place where my

sorting two corresponding lists?

2009-04-20 Thread Esmail
list based on the 'values' list so that I end up with the following two list: items = [town, apple, car, phone] values = [7, 5, 2, 1] So I would like to keep the corresponding value still corresponding after the sorting. Is there an easy/nice/Pythonic way to do this? Tha

Re: sorting two corresponding lists?

2009-04-20 Thread Esmail
Hi Diez, Thanks for this, I had seen zip() before but had no idea really what it does, this will serve as good motivation to find out more. I'm amazed at what this language can do (and the helpfulness of the people on the list here). Best, Esmail Diez B. Roggisch wrote: items = zip(*s

Re: sorting two corresponding lists?

2009-04-20 Thread Esmail
been stored away for future use. Thanks again, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting two corresponding lists?

2009-04-20 Thread Esmail
Thanks Luis, more code for me to study and learn from. Esmail Luis Alberto Zarrabeitia Gomez wrote: I've used this sometimes: -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting two corresponding lists?

2009-04-21 Thread Esmail
Esmail wrote: items = [apple, car, town, phone] values = [5, 2, 7, 1] I would like to sort the 'items' list based on the 'values' list so that I end up with the following two list: items = [town, apple, car, phone] values = [7, 5, 2, 1] Hello all, thanks for all the

simple question re list iteration semantics

2009-04-21 Thread Esmail
ays be the same, or am I mistaken? Would the 2nd one be considered more Pythonic? (It looks both clearer and cleaner to me). Thanks. Esmail -- http://mail.python.org/mailman/listinfo/python-list

pyflakes, pylint, pychecker - and other tools

2009-04-21 Thread Esmail
What is the consensus of the Python community regarding these code checkers? In particular, are the stylistic recommendations that pylint makes considered sensible/valid? Are there any other tools you consider essential to Python development? Thanks. Esmail -- http://mail.python.org/mailman

Re: simple question re list iteration semantics

2009-04-21 Thread Esmail
Thanks everyone, as usual, very informative posts! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Essential tools for Python development

2009-04-21 Thread Esmail
Great list Ben, I use emacs and will check out the tools you listed. What techniques/tools do you recommend for debugging? Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: simple question re list iteration semantics

2009-04-21 Thread Esmail
Paul Rubin wrote: Esmail writes: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i Not the same--after the exit of the first loop, 'i' is the length of the list. After the exit of the second loop, 'i' is the

Re: pyflakes, pylint, pychecker - and other tools

2009-04-22 Thread Esmail
Colin J. Williams wrote: Esmail wrote: What is the consensus of the Python community regarding these code checkers? In particular, are the stylistic recommendations that pylint makes considered sensible/valid? pylint seems a bit heavy handled, a bit too much PEP 8, Just having used this

pylab quick reference? (matplotlib)

2009-04-22 Thread Esmail
gging into specific commands. What I'm looking for is something small enough to print out (< 10-20 pages) that gives a sufficient overview so that I know what's available. I've looked on the web without much success. I'd be grateful if you have any pointers. Thanks! Esmai

Re: pylab quick reference? (matplotlib)

2009-04-22 Thread Esmail
norseman wrote: Just out of curiosity, have you tried: import pylab help(pylab) The next step is to print it, Ah .. I didn't know this, great idea. This is what I used to get the contents into a file for printing python -c 'import pylab; help(pylab)' > pylab.t

Re: pylab quick reference? (matplotlib)

2009-04-22 Thread Esmail
his technique better than any formal documentation almost. Btw, there is a specific matplotlib list as well. https://lists.sourceforge.net/lists/listinfo/matplotlib-users I just discovered it after I posted here :-) .. still glad I did. Thanks again Ben, Esmail -- http://mail.python.org/mai

Re: pylab quick reference? (matplotlib)

2009-04-23 Thread Esmail
ylab.html' file wrote pylab.html Ah .. and there I thought I'd impress everyone with my python command line :-) I had heard of pydoc before, but am not familiar with (it's on my list of Python tools to explore), so many thanks for showing me how to get a nice html formatted pag

Re: Essential tools for Python development

2009-04-23 Thread Esmail
into python mode, and I haven't had time to find out why). At this point I do most of my development under Linux/emacs anyway. Best, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Essential tools for Python development

2009-04-23 Thread Esmail
! You get the picture. thanks for the suggestion. The name made me think that this would be only for the Windows platform, but it turns out it's multi-platform. I downloaded the Linux version, but haven't had time to explore it yet, but plan to. Esmail -- http://mail.python.org/mai

Re: sorting two corresponding lists?

2009-04-23 Thread Esmail
>>> new_items = [items[x] for x in [i for i in map(values.index, new_values)]] >>> print(new_values) [7, 5, 2, 1] >>> print(new_items) ['town', 'apple', 'car', 'phone'] >>> Cool .. always good to know alternative ways of accomplishing a task. Esmail -- http://mail.python.org/mailman/listinfo/python-list

best way to compare contents of 2 lists?

2009-04-23 Thread Esmail
could sort them and then compare them. I.e., sorted(a)==sorted(b) I am wondering if there is a more efficient/preferred way to do so. Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-23 Thread Esmail
Esmail wrote: What is the best way to compare the *contents* of two different lists regardless of their respective order? The lists will have the same number of items, and be of the same type. E.g. a trivial example (my lists will be larger), a=[1, 2, 3] b=[2, 3, 1] should yield true if a==b

Re: best way to compare contents of 2 lists?

2009-04-23 Thread Esmail
David Robinow wrote: On Thu, Apr 23, 2009 at 9:31 PM, Esmail wrote: What is the best way to compare the *contents* of two different lists regardless of their respective order? The lists will have the same number of items, and be of the same type. E.g. a trivial example (my lists will be

Re: best way to compare contents of 2 lists?

2009-04-23 Thread Esmail
lications with large amopunts of data. Yes, I wonder about these sort of things too, not knowing too much about how Python does things internally. Thanks for the suggestion, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
John Yeung wrote: so does your initial solution, which I like best: sorted(a)==sorted(b) This is concise, clear, and in my opinion, the most Pythonic. It may well even be the fastest. Great .. I can live with that :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
MRAB wrote: You could use Raymond Hettinger's Counter class: http://code.activestate.com/recipes/576611/ on both lists and compare them for equality. thanks for the pointer, I'll study the code provided. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
Thanks all, after reading all the posting and suggestions for alternatives, I think I'll be going with sorted(a)==sorted(b) it seems fast, intuitive and clean and can deal with duplicates too. Best, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
Piet van Oostrum wrote: John Yeung (JY) wrote: JY> It takes care of the duplicates, but so does your initial solution, JY> which I like best: sorted(a)==sorted(b) JY> This is concise, clear, and in my opinion, the most Pythonic. It may JY> well even be the fastest. (If you didn't have

Re: Learning Python the quick way

2009-04-25 Thread Esmail
not programming) use? Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python the quick way

2009-04-25 Thread Esmail
Thanks Tim, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-25 Thread Esmail
books, chapters, computer programs, manuals, etc... These need the searchers (equivalent to the Unix diff) for checking equivalence.) HTH Steve Thanks Steve for bringing up various items to consider for these sort of tasks, very helpful indeed. Best, Esmail -- http://mail.python.org/ma

Re: debugging in IPython

2009-04-25 Thread Esmail
I seem to recall something about starting up the python (and ipython) interpreter with the -i flag, but I am not certain. There is a ipython mailing list/user group too, you may want to post your query there too. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: pyflakes, pylint, pychecker - and other tools

2009-04-27 Thread Esmail
ided to give all of them a try :-) Esmail -- http://mail.python.org/mailman/listinfo/python-list

print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
print is going away eventually and we should start using something else? Is that true and if so, what? Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
Matt Nordhoff wrote: Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way to use print to write formatted output to files? Also, it seems

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
king some silly mistake, plus I have been meaning to find out more about this too, so this is a good chance to learn something new). Thanks again! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
Duncan Booth wrote: Esmail wrote: (for some reason I can't get the from __future__ import to work, You can only use the print function on 2.6 and later. If you have an older version of Python then you'll get that error. Ooops, yes, you wrote that and I tried with 2.6 under W

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
very least. <...> I hope that the information will help you decide what to use. absolutely, very useful information, thanks! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
(123, 456.789, baz = 123.456) 'foo: 123 bar: 123.5 4.567890e+02' I'll have to check it out - thanks again, Esmail -- http://mail.python.org/mailman/listinfo/python-list

for with decimal values?

2009-05-02 Thread Esmail
ed nothing). Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: for with decimal values?

2009-05-02 Thread Esmail
Thanks all, I appreciate the various suggestions and caveats. Just wanted to make sure I'm not re-inventing the wheel as Python seems to have already so much. Cheers, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: for with decimal values?

2009-05-02 Thread Esmail
[email protected] wrote: Esmail: Is there a Python construct to allow me to do something like this: for i in range(-10.5, 10.5, 0.1): Sometimes I use an improved version of this: http://code.activestate.com/recipes/66472/ neat .. lots of code to study there. Thanks, Esmail

Re: for with decimal values?

2009-05-02 Thread Esmail
105)) >>> for amount in amounts: ... print amount ... Another nice solution stored away for use! Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: for with decimal values?

2009-05-03 Thread Esmail
Gabriel Genellina wrote: Isn't so easy. You have representation errors and rounding errors here, and they accumulate. The last number printed should be 10.4 but I get 10.5: ... 10.3 10.4 10.5 (or more precisely, 10.459) Also, after exiting a for loop, the *last* value used is reta

need help with properties

2009-05-09 Thread Esmail
thing simple here... Thanks, Esmail --- #!/usr/bin/env python # # quick test to deal with 'private' attributes and # python properties ... # import sys class Rectangle(object): def __init__(self): self.__width = 0 self.__height = 0 def setSize(self, width, height)

Re: need help with properties

2009-05-09 Thread Esmail
hi Scott, Scott David Daniels wrote: Esmail wrote: I am just reading about properties in Python. I am thinking of this as an indirection mechanism, is that wrong? If so, how come the getter/setters aren't called when I use properties instead of the functions directly? Because you we

Re: need help with properties

2009-05-09 Thread Esmail
ed. What you probably intended to do was this: print '-' r.size = 3, 7 print r.size Yup, I know Python is a dynamically typed language, but I wish it would point this sort of silliness out .. but there are tradeoffs. I should probably run pyflakes/pychecker/pylint on my my tiny

Re: need help with properties

2009-05-09 Thread Esmail
Scott David Daniels wrote: <... good stuff ... > the Python 3.X world is wisely losing the unpacking in parameter passing trick. Thanks Scott, useful information, Esmail -- http://mail.python.org/mailman/listinfo/python-list

ConfigParser examples?

2009-05-15 Thread Esmail
the necessary information from this place without the need to edit the program and its flags. Some sample code for using ConfigParser would be helpful - haven't been able to find any on-line so far beyond the standard documentation. Thanks, Esmail -- http://mail.python.org/mailman/listinfo/p

Re: ConfigParser examples?

2009-05-16 Thread Esmail
site before, it looks like a place with a lot of useful information! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Your Favorite Python Book

2009-05-21 Thread Esmail
k keeps getting mentioned, I'll have to check it out. Perhaps some of you can share what about it you like in particular. Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Your Favorite Python Book

2009-05-21 Thread Esmail
via it .. so perhaps I have to sign up for a trial membership for this? I'd prefer to do this w/o .. so I guess I'll poke around a bit more. Thanks for the lead, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Optimizing math functions

2009-05-23 Thread Esmail
me sort of simple Python module that would allow me to evaluate this type of function? In this particular instance I am interested in the minimum of x * sin(4*x) + 1.1 * sin(2*y), where x,y in range 0-10 though in other problems the range may not be identical for x and y. Thanks, Esmail ps: D

Re: Optimizing math functions

2009-05-23 Thread Esmail
Steven D'Aprano wrote: On Sat, 23 May 2009 09:22:59 -0400, Esmail wrote: Hello all, I would like to maximize or minimize a given math function over a specific set of values, in Python preferably. ... What it apparently can't do is for maximize (or minimize) functions that c

Python -> R?

2009-05-23 Thread Esmail
Hello! Anyone using Python scripts and accessing some of R's functionality? If so, what are you using? I have read about RPy, is that a good solution? Are there others that can be recommended or are preferred? I would prefer to code in Python instead of R :-) Thanks, Esmail --

  1   2   >