Re: Updating path.py

2010-07-27 Thread Michael Hoffman
Robert Kern wrote: On 7/26/10 5:16 PM, Michael Hoffman wrote: I have been using Jason Orendorff's path.py module for a long time. It is very useful. The only problem is that Python 2.6 deprecates the md5 module it imports, so I (and others using my software) now get this warning whenever

Updating path.py

2010-07-26 Thread Michael Hoffman
all change. The question is what is the best way to do that and ensure continuity with the previous versions. Can I (or someone else) take over the PyPI entry in question? Other suggestions? Many thanks, Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Presentation software for Python code

2009-04-24 Thread Michael Hoffman
Sebastian Wiesner wrote: I'm willing to consider TeX- and HTML-based approaches. I can recommend latex with the beamer package. It doesn't directly support formatting of code snippets, but the pygments syntax highlighter comes with a Latex formatter. This is what I have been doing so fa

Re: Presentation software for Python code

2009-04-23 Thread Michael Hoffman
alex23 wrote: How do you feel about reStructuredText? If you're open to it, I highly recommend Bruce: http://pypi.python.org/pypi/bruce That looks like it would be perfect. Unfortunately it doesn't seem to work on my Windows laptop: C:\Documents and Settings\Michael\Desktop\bruce-3.2.1>C:\

Re: Presentation software for Python code

2009-04-23 Thread Michael Hoffman
Thanks for the suggestions. And if you do use Crunchy for a presentation, you might be interested in the html style used for Crunchy's own talk at the latest Pycon: http://us.pycon.org/media/2009/talkdata/PyCon2009/012/crunchy_.html H, I have to click on the next link every time? The best

Presentation software for Python code

2009-04-23 Thread Michael Hoffman
Does anyone here have software they would suggest for making a presentation that includes Python code? Other than that it would probably be mainly bullet points. I'm willing to consider TeX- and HTML-based approaches. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the full path of an executable

2009-01-16 Thread Michael Hoffman
Unknown wrote: On 2009-01-16, Michael Hoffman <9qobl2...@sneakemail.com> wrote: Is there a portable way to find the full path of a filename that would be called by os.execvp()? Yes. Use os.path.abspath() on the name before you call it with os.execvp() That doesn't work: Python

Finding the full path of an executable

2009-01-16 Thread Michael Hoffman
Is there a portable way to find the full path of a filename that would be called by os.execvp()? Thanks, Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Using NamedTemporaryDir instead of multiple NamedTemporaryFiles

2008-09-09 Thread Michael Hoffman
Michael Hoffman wrote: unlink = os.unlink Actually, I need to use shutil.rmtree instead, but you get the idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using NamedTemporaryDir instead of multiple NamedTemporaryFiles

2008-09-09 Thread Michael Hoffman
Please accept my apologies if this message was posted several times. My newsreader claimed that a timeout error kept the message from being posted, but I think it got through. -- http://mail.python.org/mailman/listinfo/python-list

Using NamedTemporaryDir instead of multiple NamedTemporaryFiles

2008-09-09 Thread Michael Hoffman
I am writing a library that creates temporary files and calls a series of external programs to process these files. Sometimes these external programs create files in the same directory as the input files, so to make sure they are all deleted, one must create them in a temporary directory, then

Re: pylint style convention

2007-07-23 Thread Michael Hoffman
ion is it referring to? Should these really be all > caps? There's a style convention that global constants at file scope are defined in all caps. Personally, I do all my optparsing in a special function rather than in the __name__ == '__main__' block. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting values out of a CSV

2007-07-13 Thread Michael Hoffman
ehensions are faster. Why do you think that? -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-10 Thread Michael Hoffman
want? A bool typecode for the stdlib array module? I can guess a number of things that you might mean, but it would be best if you explained with an example of what current behavior is and what you would like it to be. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-04 Thread Michael Hoffman
>> Oh yes ? So what's the compiler doing, and what are those .pyc files ? >> (hint: read the doc) > > Sorry, I surely know that Python has a compile time, I wanted to say > somthing like "compile time checks except from syntax". Well, if you try to reassign

Re: Python compilation ??

2007-07-02 Thread Michael Hoffman
utes, only the modules that > are imported. I think you mean that CPython doesn't save the results of the compilation of a script. The scripts are compiled every time they are run, as you go on to say. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python changing keywords name

2007-07-02 Thread Michael Hoffman
Gabriel Genellina wrote: > "except" is hard to translate, and > even in English I don't see what is the intended meaning (is it a noun? > a verb? an adverb? all look wrong). It's a preposition. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Excuse me!!

2007-06-28 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > Haven't you thought about what is the right religion?! Sure, why do you think I use Python? > Here you will get the answer Agreed. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: socket on cygwin python

2007-06-25 Thread Michael Hoffman
tive Windows Python. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with emf/wmf files

2007-06-24 Thread Michael Hoffman
rt WMF (not EMF) to SVG or EPS. http://wvware.sourceforge.net/libwmf.html -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing variable from a function within a function

2007-06-24 Thread Michael Hoffman
rn euclid(c,d) > > Unfortunately this doesnt work since a,a1,b,b1 arent declared in the > function. Is there a way to make these variables accessible to the > euclid function. Or is there a better way to design this function? Well, it would be simpler to pass through all the variab

Re: Python changing keywords name

2007-06-23 Thread Michael Hoffman
helpful <http://www.catb.org/~esr/faqs/smart-questions.html>. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-06-23 Thread Michael Hoffman
d >> the ShedSkin/Psyco restrictions seem to be enough to allow that. >> Type annotations don't seem to solve any problem that really needs >> to be solved. >> >> The main advantage of strongly typed systems is that more errors >> are detected at co

Re: What was that web interaction library called again?

2007-06-22 Thread Michael Hoffman
project, I can't > remember... but perhaps someone here can remind me what it was? If so, > there may be yet another young python programmer in training :-) BeautifulSoup? -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Indenting in Emacs

2007-06-22 Thread Michael Hoffman
gt;>> that. >>> >>> I checked the latest copy out from sourceforge and that was 4.75 too. >>> >>> Can someone please tell me where to find the latest? >>> >> It's from Emacs 22. > > Note that's a different python-mode to the

Re: Can python access windows clipboard

2007-06-21 Thread Michael Hoffman
MaHL wrote: > Can I use python to copy something(like a string) to the clipboard, so > that I can paste it somewhere else. Is there a way to do this? If you're using Cygwin Python you can just open /dev/clipboard and work on that. -- Michael Hoffman -- http://mail.python.org/mailm

Re: Indenting in Emacs

2007-06-21 Thread Michael Hoffman
description='Position reference' )), I'm using py-version "$Revision$." Oops! Anyway, try to install the latest python-mode, whatever that is, if it isn't 4.78. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-06-20 Thread Michael Hoffman
Python. It might be Perl, or OCaml, or Java, or C, or JCL. If you want static type checking, Python definitely isn't the right tool for you. If you asked Java programmers why you couldn't turn *off* Java's static type checking if you wanted to, you'd probably get a similar respon

Re: DFW Pythoneers Meeting THIS Saturday

2007-06-20 Thread Michael Hoffman
ted to needless name-calling as a result of your mistake, which I don't think enhances the usefulness of this forum. What exactly are you trying to achieve? -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: DFW Pythoneers Meeting THIS Saturday

2007-06-20 Thread Michael Hoffman
peter wrote: > Just a tad arrogant, don't you think, to put a notice of some local > event on an international forum without saying where it is? It says right in the subject line! DFW. If you don't know what DFW means, then it's probably not your local area. -- Mic

Re: Questions about mathematical and statistical functionality in Python

2007-06-14 Thread Michael Hoffman
oad the resulting data frames into R for analysis and graphics. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path.normpath bug?

2007-06-14 Thread Michael Hoffman
th('//a//b//c') > \\a\b\c > > Is it intentional or is it a bug? Intentional. http://en.wikipedia.org/wiki/Path_(computing)#Universal_Naming_Convention -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I capture all exceptions especially when os.system() fail? Thanks

2007-06-14 Thread Michael Hoffman
he >> script printed: >> sh: wrong_command_test: command not found >> well Done > > That's because it is not an exception, it is an error message coming > from your shell, not from Python. Of course if you use subprocess.check_call() instead of os.system(), it wil

Re: Optimizing constants in loops

2007-06-13 Thread Michael Hoffman
ve (which > it will not if you use a custom variable). Thanks, I didn't know that __debug__ was optimized like this. But that was really just a specific example of the general case. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Optimizing constants in loops

2007-06-13 Thread Michael Hoffman
for index in xrange(100): print index do_stuff(index) else: for index in xrange(100): do_stuff(index) It would be nice if this sort of thing could be done automatically, either by the interpreter or a function decorator. -- Mich

Re: load data infile problem

2007-06-10 Thread Michael Hoffman
ECTED]' (Using password: YES) This has nothing to do with Python. It is obvious from the error that the user "papermen" doesn't have the privileges to load data into that table. Ask your database administrator to give you the appropriate privileges. Followups set. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex problem with cdef'd attribute

2007-06-10 Thread Michael Hoffman
bird to access various infrequently-used mailing lists via NNTP and Gmane. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: *Naming Conventions*

2007-06-05 Thread Michael Hoffman
Neil Cerutti wrote: > I find i and j preferable to overly generic terms like "item." Well, I probably wouldn't use "item" in a real example, unless it were for a truly generic function designed to act on all sequences. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: *Naming Conventions*

2007-06-04 Thread Michael Hoffman
t; > Or should the good python hacker do that differently? Hope not ;). Well, yes, I would do: for item in data: do_stuff(item) or, if using enumerate: for item_index, item in enumerate(data): do_stuff(item_index, item) I agree with Bruno that i and j should be used only for indices, but I'm usually less terse than that. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex: problem with blanks in string

2007-06-04 Thread Michael Hoffman
sages and versions of Pyrex/Python/GCC. Better yet, do this in the Pyrex mailing list rather than here. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: *Naming Conventions*

2007-06-03 Thread Michael Hoffman
Michael Hoffman wrote: > Thorsten Kampe wrote: > >> for validanswer in validanswers: >> if myAnswers.myanswer in myAnswers.validAnswers[validanswer]: >> MyOptions['style'] = validanswer > > I usually try to avoid using "my" because I

Re: *Naming Conventions*

2007-06-03 Thread Michael Hoffman
Thorsten Kampe wrote: > for validanswer in validanswers: > if myAnswers.myanswer in myAnswers.validAnswers[validanswer]: > MyOptions['style'] = validanswer I usually try to avoid using "my" because I find it obscures a better understanding of what

Re: __getslice__ depreciation

2007-06-02 Thread Michael Hoffman
uld have RTFA A request to have the docs changed so that "Deprecated since release 2.0." in bold appears next to all three would not go amiss. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Good Python style?

2007-05-31 Thread Michael Hoffman
.split()[0] for line in blankless_words] > some_set = frozenset(first_words) Re-writing code so that it is self-documenting is almost always a better approach. Premature optimization is the root of all evil. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Inverse of id()?

2007-05-20 Thread Michael Hoffman
t what I get: Python 2.5 (r25:51908, Mar 13 2007, 08:13:14) [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> class A: pass ... >>> class B: pass ... >>> a = A() >>> id(a) 2146651820 >>> b = B() >>> id(b) 2146651948 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't embed python in C++(Mingw[3.*] compiler)

2007-05-20 Thread Michael Hoffman
Arjun Narayanan wrote: > That AND I didn't use the american spelling Py_Initiali >>> Z <<< e(); Like many words ending in -ize/-ise, initialize is listed with what you call the "American" spelling in the Oxford English Dictionary. -- Michael Hoffman -- htt

Re: questions about programming styles

2007-05-20 Thread Michael Hoffman
al_attr(args) >some_var = self.attr In many cases (I would really have to see the context to be sure) would prefer something like: def get_attr(self, args): # calculations here return calculated_value Don't have a self.attr, just return the results of get_attr(). -- Mich

Re: Slicing Arrays in this way

2007-05-03 Thread Michael Hoffman
John Machin wrote: > On May 3, 10:21 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: >> Tobiah wrote: >> >>> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10]) >>> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] >> That's not an array, it's

Re: Slicing Arrays in this way

2007-05-02 Thread Michael Hoffman
Tobiah wrote: > > >>> elegant_solution([1,2,3,4,5,6,7,8,9,10]) > [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] That's not an array, it's a list. See the array module for arrays (fixed-length, unlike variable-length lists). -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: open("output/mainwindow.h",'w') doesn't create a folder for me

2007-05-02 Thread Michael Hoffman
or me but it's throwing an error No, you have to create the folder first. Try os.makedirs() -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: While we're talking about annoyances

2007-05-02 Thread Michael Hoffman
ison > function is called for EVERY comparison. The key= function is only called > once per element. Right. Using sort(key=keyfunc) is supposed to be faster than decorate-sort-undecorate. And I think it is clearer too. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I parse a string to a tuple??

2007-04-30 Thread Michael Hoffman
27;)) > > If you don't need a tuple, and a list will do: > > the_string.split('\n') or the_string.splitlines() > If you want to get rid of the white space after each chunk of text: > > [s.strip() for s in the_string.split('\n')] -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: While we're talking about annoyances

2007-04-30 Thread Michael Hoffman
Alex Martelli wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote: > >> Alex Martelli wrote: >>> Arnaud Delobelle <[EMAIL PROTECTED]> wrote: >>>... >>>>>>> decorated.sort() >>>... >>>>> def i

Re: While we're talking about annoyances

2007-04-29 Thread Michael Hoffman
d the .sort step above. Well, counting the index() function that is called in both cases, the original rank() had one sort, but my version has two sorts. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: While we're talking about annoyances

2007-04-29 Thread Michael Hoffman
__) Hint: if you find yourself using a decorate-sort-undecorate pattern, sorted(key=func) or sequence.sort(key=func) might be a better idea. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Numbers and truth values

2007-04-28 Thread Michael Hoffman
for more information. >>> 2 == True False -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: getting rid of EOL character ?

2007-04-28 Thread Michael Hoffman
John Machin wrote: > On 27/04/2007 11:19 PM, Michael Hoffman wrote: >> stef wrote: >>> hello, >>> >>> In the previous language I used, >>> when reading a line by readline, the EOL character was removed. > > Very interesting; how did you disting

Re: My newbie annoyances so far

2007-04-27 Thread Michael Hoffman
John Nagle wrote: > (P.S. PEP 3117 is a joke, right?) Note date of creation. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: regex question

2007-04-27 Thread Michael Hoffman
t1.findall("xabcxaaaxabc") ['c', 'a', 'c'] Here it finds multiple matches, but only because the x occurs multiple times as well. In your example there is only one match. > i would expect either 'abc' or 'a', 'b', 'c' or at least just > 'a' (because that would be the first match). You are essentially doing this: group1 = "a" group1 = "b" group1 = "c" After those three statements, you wouldn't expect group1 to be "abc" or "a". You'd expect it to be "c". -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: getting rid of EOL character ?

2007-04-27 Thread Michael Hoffman
the 2 characters CR+LF are converted to 1 character ? > Is there a more automatic way to remove the EOL from the string ? line = line.rstrip("\r\n") should take care of it. If you leave out the parameter, it will strip out all whitespace at the end of the line, which is what I do in most cases. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser.open works in IDLE and cmd shell but not from cygwin prompt

2007-04-27 Thread Michael Hoffman
"opera"] is in your path. Your Cygwin environment must be set so one of these is in your path when it isn't normally. You should also submit a bug. > And, more to the point, how can I use webbrowser from scripts launched under > cygwin? If you're using native Windows

Re: List objects are un-hashable

2007-04-27 Thread Michael Hoffman
file: for line in infile: words = line.split() print " ".join(word for word in words if keyword.iskeyword(word)) -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Generalized range

2007-04-26 Thread Michael Hoffman
Michael Hoffman wrote: > How about something like this: > > index = 0 > while res < maximum: > yield minimum + (step * index) > index += 1 Well it really would have to be something LIKE that since I never defined res. Let's try that again: index = 0 res = m

Re: Generalized range

2007-04-26 Thread Michael Hoffman
yield minimum + (step * index) index += 1 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Dedicated CPU core for Python?

2007-04-26 Thread Michael Hoffman
compiles the human-readable code to a bytecode which it then runs on a virtual machine. -- Michael Hoffman (no relation) -- http://mail.python.org/mailman/listinfo/python-list

Re: My python annoyances so far

2007-04-26 Thread Michael Hoffman
they all begin with a-m? The answer would be that it would make the language harder to use to cram concepts that should more naturally start with n-z into spellings that start with a-m. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Generalized range

2007-04-26 Thread Michael Hoffman
alues of iMax, iMin and iStep. I suspect this requires a > detailed understanding of the implementation of floating point > arithmetic, and would appreciate hearing any thoughts you might have > on gilding this lily. In addition to the comments of Stargaming, most of which I agree with, I th

Re: My python annoyances so far

2007-04-26 Thread Michael Hoffman
7stud wrote: > [EMAIL PROTECTED] wrote: >> Annoyances: >> > > Every language has annoyances. Python is no exception. Post away. > Anyone that is offended can go drink a Guinness. I find Guinness annoying. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Tutorial creates confusion about slices

2007-04-26 Thread Michael Hoffman
ange > much easier. > > I suppose the above model could avoid this notational problem if > you say that a[k] means the one element slice a[k:k+1] > (technically true for strings, but false for lists), rather than > ever thinking of item indexes as pointing directly at an item. >

Re: Access to raw command line?

2007-04-26 Thread Michael Hoffman
; gpxlist.txt ./myprog.py --gpx-file=gpxlist.txt *.jpg Or to accept more than one file per argument: ./myprog.py -t "$(echo *.gpx)" *.jpg Personally I would prefer the file list approach. If you start expanding wildcards yourself, then if someone stupidly wants to use a wildcard character, they'll have to triple-escape things, and it'll just be messy. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding conventions for class names

2007-04-26 Thread Michael Hoffman
t example is probably the transition from sets.Set to __builtin__.set. The API changed but only slightly. So far sets.Set retains the old implementation--it is not a wrapper for __builtin__.set. Future modules may be implemented differently. -- Michael Hoffman -- http://mail.python.org/mailman/lis

Re: sorting question

2007-04-25 Thread Michael Hoffman
> but l isn't then changed in place. > > Using > > sorted(l,operator.itemgetter(1)) > > behaves as I'd expect, but I really want something like > operator.itemgetter(1).itemgetter(1), which (understandably) causes a > syntax error. Unless you are do

Re: bitwise shift?

2007-04-25 Thread Michael Hoffman
e a ValueError exception." >>> sys.maxint << 2 8589934588L >>> 2**31 2147483648L It looks like the limitation has been removed. This might be a nice optimization as well, as 1 << n is faster than 2**n for large enough n. Might be rare, although I have a friend who has been doing this all day. In Python. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: bitwise shift?

2007-04-25 Thread Michael Hoffman
eans "1 shift left by k" Yes. > which is the same as multiplying with k. No. Try starting the Python interpreter and entering 1 << 10. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding conventions for class names

2007-04-25 Thread Michael Hoffman
s compatibility. Don't know about `set` and `object`. I guess > it's foolish consistency!? Well originally there was sets.Set (uppercase). It became set when it went to being a built-in. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding conventions for class names

2007-04-25 Thread Michael Hoffman
Kay Schluehr wrote: > My question is: does anyone actually follow guidelines here Yes. > and if yes > which ones and are they resonable ( e.g. stable with regard to > refactoring etc. )? All of them that I know of. What does it mean to be "stable with regard to refactoring e

Re: os.system('tar -c * | tar -C dst') ##Any other suggestions...

2007-04-24 Thread Michael Hoffman
ow > > Any suggestions on a different approach or fix? What do you want to do? What do you think that is supposed to do? What does this have to do with Python? -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching a specific IO error

2007-04-24 Thread Michael Hoffman
gt; permission to manipulate a file, os.access is a good function. The try first approach is better for at least two reasons: 1) It saves you an extra stat() on the disk, which can be really important for some filesystems I use :) 2) It is atomic. If os.path.isfile() returns True but the file is deleted before you open it, you are still going to have to handle the exception. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: defining user exceptions

2007-04-24 Thread Michael Hoffman
how to define this RPMError. I looked at python > docs but they were not useful. http://docs.python.org/tut/node10.html#SECTION001050 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Tutorial creates confusion about slices

2007-04-24 Thread Michael Hoffman
[Michael Hoffman] >> Personally, I do not think of slices in the way this tutorial suggests, >> but I think taking it out without replacement would not help. If you >> want to add a more accurate replacement, I think that would be better >> received than just saying th

Re: Tutorial creates confusion about slices

2007-04-24 Thread Michael Hoffman
ying that the section should be removed. Even more so if you provide it in the form of a patch. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: adjust

2007-04-24 Thread Michael Hoffman
Completing with a trailing ",", using the entire sequence instead of a subset, and dealing with your hex constants are left as an exercise to the reader. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Would You Write Python Articles or Screencasts for Money?

2007-04-24 Thread Michael Hoffman
rnet.and earn 4000USD every month." So you'll have to do better than that for an adequate incentive. ;) Seems like a good idea, although I don't have any constructive suggestions at this point. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: I/O Error

2007-04-24 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > file_input = raw_input("Enter The ODX File Path:") > odx_file_output = raw_input("Enter the output file path : ") > log_file_output = raw_input("Enter the path for LogFile : ") > > saveout = sys.stdout > try: > f_open=open(odx_file_output, 'w') > except: > prin

Re: python style guide inconsistencies

2007-04-23 Thread Michael Hoffman
r simply link to PEPs 8 and 257. What is > the point of keeping old, out-of-date essays up on python.org? That > beginning comment does not indicate that the essay is any different from > the PEPs. http://wiki.python.org/moin/PythonWebsiteCreatingNewTickets -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Shebang or Hashbang for modules or not?

2007-04-23 Thread Michael Hoffman
Steven W. Orr wrote: > On Saturday, Apr 21st 2007 at 19:18 +0100, quoth Michael Hoffman: > > =>Chris Lasher wrote: > =>> Should a Python module not intended to be executed have shebang/ > =>> hashbang (e.g., "#!/usr/bin/env python") or not? I'm used to

Re: Two syntax questions (newbie)

2007-04-23 Thread Michael Hoffman
ted)(items) A clever little hack, but please don't do this. Anyone else who will read your code will thank you. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Shebang or Hashbang for modules or not?

2007-04-21 Thread Michael Hoffman
Python code intended to be > executable (i.e., run from the command line). Personally I include it in all of them, as part of boilerplate in a template. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: str.itersplit()

2007-04-21 Thread Michael Hoffman
y make such a difference? It would if you were dealing with enormous blocks of text at once, say from a database. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: setDaemon problem.

2007-04-20 Thread Michael Hoffman
Richard Brodie wrote: > "Michael Hoffman" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>> Neither is particularly intuitive; it just depends whether you are more >>> familiar with the Posix terminology or the Java one. I persona

Re: setDaemon problem.

2007-04-20 Thread Michael Hoffman
ink setDaemon >> should be renamed to setDetached or something similar. > > Neither is particularly intuitive; it just depends whether you are more > familiar with the Posix terminology or the Java one. I personally prefer > detached but there is little chance of a name change now.

Re: Problems with os.rename

2007-04-20 Thread Michael Hoffman
loial wrote: > How can I get more info what the cause of the OSError exception is? For starters, post the traceback here. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Spawn/Exec with asterisk in argument

2007-04-19 Thread Michael Hoffman
since I've worked with ipc. I usually don't think of starting new processes as being IPC. I've only ever seen it used to refer to communicating between processes after they have started. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python un-plugging the Interpreter

2007-04-19 Thread Michael Hoffman
little difficulty. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Using the Python interpreter

2007-04-18 Thread Michael Hoffman
LE. Here's what I did: > >>>> Script1.py > Traceback (most recent call last): > File "", line 1, in ? > NameError: name Script1 is not defined > >>>> python Script1.py You need to do this from a Windows command line, not from Python. C:\Python25>

Re: Spawn/Exec with asterisk in argument

2007-04-18 Thread Michael Hoffman
=True) Another way is using the glob module (and optionally os.path.expanduser() for tilde expansion and os.path.expandvars() for variable expansion, other things that are normally taken care of by the shell). -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-18 Thread Michael Hoffman
type( x ) == NoneType: >> # true >> < code > >> else: >> # false; do something else. >> < more code > >> >> Steven Howe > > Is that any better than this? > > if x is None: > # do something > else: > # d

Re: converting currency using locals

2007-04-18 Thread Michael Hoffman
ith national specification, but this could be done > only in python 2.5. Any solution for 2.4? I think you mean locale, for anyone else who was puzzled by this. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
[Michael Hoffman] >> For x root use y**(1/x) [Steve Holden] > >>> 3.14159 ** (1/3) > 1.0 > >>> > > So the cube root of pi is 1? I don't think so. > > For generic roots use y ** (1.0 / x) Yes, good point. :) -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
[Michael Hoffman] >> In floating point arithmetic, the naive way of calculating both roots >> always using the formula (-b +/- sqrt(b**2 - 4*a*c))/2*a will give you >> inaccurate results sometimes. See >> <http://www.cse.uiuc.edu/eot/modules/floating_point/quadrati

  1   2   3   4   5   >