Re: Python on Crays

2009-08-21 Thread Mark Dickinson
linked to involve messing with the PYTHONPATH environment variable. If you could post a log somewhere[*] showing the exact commands that you executed, along with all the output (and especially all the output from 'make' and 'make install'), that might help someone diagnose th

Re: Three-Phase-Diagrams with matplotlib

2009-08-21 Thread Mark Lawrence
the triangle marking different compositions of the substances in percent, e.g. in metallurgy 20% Al2O3, 45% CaO and 35% SiO2. As noone else has responded try the matplotlib users' mailing list, see http://sourceforge.net/mail/?group_id=80706 -- Kindest regards. Mark Lawrence. --

Re: Division and right shift in python

2009-08-25 Thread Mark Tolonen
0 -s x=1024 "x/pow(2,5)" 1000 loops, best of 3: 0.468 usec per loop Right-shift is over 4x faster. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: break unichr instead of fix ord?

2009-08-25 Thread Mark Tolonen
odedata unicodedata.name(x) 'LINEAR B SYLLABLE B025 A2' ord(x) 65600 hex(ord(x)) '0x10040' unicodedata.name(chr(0x10040)) 'LINEAR B SYLLABLE B025 A2' ord(chr(0x10040)) 65600 print(ascii(chr(0x10040))) '\ud800\udc40' -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: all possible matchings of elements of two lists

2009-08-26 Thread Mark Dickinson
on. >>> import itertools >>> for p in itertools.permutations('abc', 2): print zip([1,2], p) ... [(1, 'a'), (2, 'b')] [(1, 'a'), (2, 'c')] [(1, 'b'), (2, 'a')] [(1, 'b'), (2, 'c')] [(1, 'c'), (2, 'a')] [(1, 'c'), (2, 'b')] -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on Crays

2009-08-27 Thread Mark Dickinson
d similarly for the other modules in that section. Make sure that you're editing the Modules/Setup file *after* the configure step and *before* the make step. (2) Find a local Unix/Python guru and ask him/her to help out. These sorts of problems are generally much easier to figur

Re: Question on the "csv" library

2009-08-27 Thread Mark Lawrence
something seems not to be working properly Same result list: I get an empty list sheet = list(spamReader) Thank you again for your help, which is highly appreciated. Vicente Soler -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on the "csv" library

2009-08-28 Thread Mark Lawrence
John Machin wrote: On Aug 28, 6:44 am, Mark Lawrence wrote: vsoler wrote: On Aug 27, 9:42 pm, Andreas Waldenburger 1- the csv file was generated with Excel 2007; no prompts for what the separator should be; Excel has used ";" by default, without asking anything I find this di

Re: [OT] How do I reply to a thread by sending a message to [email protected]

2009-08-28 Thread Mark Lawrence
ink this sums it up. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Modules/packages by GvR?

2009-08-28 Thread Mark Lawrence
sume that somebody is organising a whip round for him? Any and all currencies accepted? -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: An assessment of Tkinter and IDLE

2009-08-28 Thread Mark Roseman
With regard to Tkinter documentation, and in particular the newer, more modern aspects thereof (e.g. ttk, styles, etc.) please have a look at the tutorial at http://www.tkdocs.com Would it be useful to link to this from the main Python Tkinter documentation? Mark -- http://mail.python.org

Re: Question on the "csv" library

2009-08-28 Thread Mark Lawrence
s a blank But, perhaps, there is no standard alternative to CSV !!! This depends on the use case of yourself or your users. If you could give more detail on what you are trying to achieve then I'm sure that more help will be forthcoming. For example, could the file be saved in Excel

Re: An assessment of Tkinter and IDLE

2009-08-28 Thread Mark Lawrence
r wrote: On Aug 28, 11:12 am, Mark Roseman wrote: Would it be useful to link to this from the main Python Tkinter documentation? Mark Thanks Mark, but i would hate to see more links to TCL code in the python docs. Whats the use of Tkinter if the docs are in TCL. Just learn TCL and skip the

Re: An assessment of Tkinter and IDLE

2009-08-28 Thread Mark Roseman
r wrote: > On Aug 28, 11:12 am, Mark Roseman wrote: > > Would it be useful to link to this from the main Python Tkinter > > documentation? > > Thanks Mark, but i would hate to see more links to TCL code in the > python docs. Whats the use of Tkinter if the docs are in T

Re: Is behavior of += intentional for int?

2009-08-30 Thread Mark Dickinson
#x27; then creates another *new* integer object with value 3 and binds the name m to it. In other words, it could work in exactly the same way as the following works in Python: >>> n = {} >>> n[1729] = 10585 >>> m = {} >>> m {} The modification to n doesn't affect m, since the two occurrences of {} give distinct dictionary objects. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3: hex() on arbitrary classes

2009-09-01 Thread Mark Dickinson
t;> class X: ... def __index__(self): return 3 ... >>> hex(X()) '0x3' >>> range(10)[X()] 3 >>> 'abc' * X() 'abcabcabc' -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3: hex() on arbitrary classes

2009-09-02 Thread Mark Dickinson
On Sep 1, 5:31 pm, Philipp Hagemeister wrote: > Mark Dickinson wrote: > > (...) If you want to be > > able to interpret instances of X as integers in the various Python > > contexts that expect integers (e.g., hex(), but also things like list > > indexing), you sho

Re: Simple addition to random module - Student's t

2009-09-02 Thread Mark Dickinson
/. Alternatively, you might also consider submitting something to the Python package index, http://pypi.python.org/pypi, or posting this as a recipe at http://code.activestate.com/recipes/langs/python/ -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple addition to random module - Student's t

2009-09-02 Thread Mark Dickinson
On Sep 2, 2:51 pm, Thomas Philips wrote: > def student_t(df):         # df is the number of degrees of freedom >     if df < 2  or int(df) != df: >        raise ValueError, 'student_tvariate: df must be a integer > 1' By the way, why do you exclude the possibility df=

Re: Simple addition to random module - Student's t

2009-09-02 Thread Mark Dickinson
r integrality of df. In fact, you could just drop the tests on df entirely: df <= 0.0 will be picked up in the gammavariate call. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: print() a list

2009-09-04 Thread Mark Tolonen
"DarkBlue" wrote in message news:[email protected]... I am trying to get used to the new print() syntax prior to installing python 3.1: test=[["VG", "Virgin Islands, British"],["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],["EH", "We

Re: print() a list

2009-09-04 Thread Mark Tolonen
You need the following statement to use print() in Python 2.6: from __future__ import print_function test = [ ["VG", "Virgin Islands, British"], ["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],

Re: Something confusing about non-greedy reg exp match

2009-09-06 Thread Mark Tolonen
27;ll need something extra to not match the first hello. a=re.search(r'(?money') a.group(0) 'hello funny money' -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Smallest float different from 0.0?

2009-09-07 Thread Mark Dickinson
then sys.float_info.min * 2**(1-sys.float_info.mant_dig) will work. But on 99.99%+ of systems you'll find Python running on, it's going to be 2**-1074. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Smallest float different from 0.0?

2009-09-07 Thread Mark Dickinson
ng exactly the same format. > I suppose that > > 2**(sys.float_info.min_exp - sys.float_info.mant_dig) > > would also work? Yes. This all only works for IEEE 754 binary formats, though. Most other floating-point formats you're likely to meet (IBM hex floats, VAX D and G, Cray float

Re: Module for Fisher's exact test?

2009-09-07 Thread Mark Dickinson
On Sep 7, 3:50 am, gb345 wrote: > Before I roll my own, is there a good Python module for computing > the Fisher's exact test stastics on 2 x 2 contingency tables? Not in the standard library, certainly. Have you tried SciPy and RPy? -- Mark -- http://mail.python.org/mailman/list

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Mark Hammond
nsive applications work better using the multiprocessing module than with the threading module. I believe you will find the above is incorrect - even with multiple interpreter states you still have a single GIL. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: using python interpreters per thread in C++ program

2009-09-07 Thread Mark Hammond
On 8/09/2009 9:16 AM, Grant Edwards wrote: On 2009-09-07, Mark Hammond wrote: CPython's GIL means that multithreading on multiple processors/cores has limitations. Each interpreter has its own GIL, so processor-intensive applications work better using the multiprocessing module than wit

Re: unicode + xml

2009-09-07 Thread Mark Tolonen
#x27;\ufffd' (the code point REPLACEMENT_CHARACTER) intermixed with other characters. The wrong encoding was probably used to decode the filename byte strings to Unicode. We can give more specific help if you specify your operating system and version of Python used. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting patterns after matching a regex

2009-09-08 Thread Mark Tolonen
t to parse out of that string. The group() method is used to get the whole string with group(0), and each of the parenthesized parts with group(n). An example: s = "FTPHOST: e4ftl01u.ecs.nasa.gov" import re re.search(r'FTPHOST: (.*)',s).group(0) 'FTPHOST: e4ftl01u.

Re: Distutils - can user designate install directory for windows installer?

2009-09-08 Thread Mark Hammond
nstalled and doesn't depend on Python already being installed. Cheers, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Class variable inheritance

2009-09-08 Thread Mark Hammond
classic-classes - search for 'method resolution order' for other hits in that document. HTH, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWin editor modification

2009-09-12 Thread Mark Tolonen
self.bannerDisplayed = True self.scintilla.SCIStartStyling(start, 31) self.style_buffer = array.array("b", (0,)*len(stringVal)) self.ColorizeInteractiveCode(stringVal, styleStart, stylePyStart) -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming ideas?

2009-09-12 Thread Mark Tolonen
program in this), okay at perl and I've just learned python. But, I have no more ideas to write programs/scripts for! Any ideas will be helpful? Here's a couple I've used if you like math and puzzles. http://projecteuler.net http://www.pythonchallenge.com -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Question regarding handling of Unicode data in Devnagari

2009-09-12 Thread Mark Tolonen
string is already Unicode. The 4th line works because it was explicitly encoded into UTF-8, and the terminal supports it. I hope this is useful to you. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: python decimals

2009-09-15 Thread Mark Dickinson
nity: is there > existing implementation? I don't want to invent the wheel again. As far as I know, no such bindings exist. There have been various efforts to rewrite the decimal module in C, but (again as far as I know) none of those efforts have come to fruition yet. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-15 Thread Mark Dickinson
ere are > 2**52 floats X where 1.0 <= X < 2.0. > The number of "normal" floats is 2 ** 64 - 2 ** 52 + 1. Since we're being picky here: Don't you mean 2 ** 64 - 2 ** 54 + 1? :) -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3.1 unicode question

2009-09-15 Thread Mark Tolonen
PEP 383) http://www.python.org/dev/peps/pep-0383/. It indicates the wrong encoding was used to decode the filename. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: preferred way to set encoding for print

2009-09-15 Thread Mark Tolonen
the default sys.stdout.encoding is something like cp936. The Pythonwin IDE in the latest version of pywin32, however, supports UTF-8 in its interactive window and displays Chinese fine. Setting PYTHONIOENCODING overrides the encoding used for stdin/stdout/stderr (See the Python hel

Re: python decimals

2009-09-16 Thread Mark Dickinson
ind such bindings useful. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: (A Possible Solution) Re: preferred way to set encoding for print

2009-09-16 Thread Mark Tolonen
"~flow" wrote in message news:643ca91c-b81c-483c-a8af-65c93b593...@r33g2000vbp.googlegroups.com... On Sep 16, 7:16 am, "Mark Tolonen" wrote: Setting PYTHONIOENCODING overrides the encoding used for stdin/stdout/stderr (See the Python help for details), but if your term

Re: Can print() be reloaded for a user defined class?

2009-09-19 Thread Mark Tolonen
f the python > manual that describes such usage. simple i assined any call to __repr__ to the __str__ methods. Just define __repr__. str() uses __repr__ if __str__ isn't defined. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Pythons in Florida (training next month)

2009-09-21 Thread Mark Lutz
t the class web page: http://home.earthlink.net/~python-training/2009-public-classes.htm If you are unable to attend in October, our next Sarasota class is already scheduled for January 19-21. Thanks, and we hope to see you in sunny Florida soon. --Mark Lutz at Python Training Ser

Re: where is ctrl+newline handled in pywin editor?

2009-09-23 Thread Mark Hammond
ng back to the left margin. Is anyone acquainted enough with the pywin editor to be able to help with this? You probably just need to check: if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000: in the OnKeyEnter handler... Cheers, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Format string with single quotes in it

2009-09-25 Thread Mark Tolonen
odName]) File "w.py", line 2, in print s % (0,0) ValueError: unsupported format character ' ' (0xa) at index 24 Inspect your input file. If you want a percent sign in a format string, use %%. s = "Here's percentages: %d%% %d%%\n" print s % (0,0) OUTPUT: Here's percentages: 0% 0% -Mark -- http://mail.python.org/mailman/listinfo/python-list

New books: Learning Python, Python Pocket Reference 4th Eds

2009-09-25 Thread Mark Lutz
and will be available shortly. Cheers, --Mark Lutz -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Win32 COM problem

2010-08-25 Thread Mark Hammond
ne seems an unlikely source of the error. Note that as win32com uses an in-process model by default, your problem may be that you changed your implementation but didn't restart the hosting process - and therefore are still using an earlier implementation. HTH, Mark -- http://mail.python.or

Re: palindrome iteration

2010-08-27 Thread Mark Lawrence
On 27/08/2010 15:43, Bruno Desthuilliers wrote: Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? It could be worse, try responding to issue 9702. :) Cheers. Mark Law

Re: palindrome iteration

2010-08-27 Thread Mark Lawrence
On 27/08/2010 17:53, MRAB wrote: On 27/08/2010 17:20, Mark Lawrence wrote: On 27/08/2010 15:43, Bruno Desthuilliers wrote: Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ?

Re: Fibonacci: How to think recursively

2010-08-28 Thread Mark Tolonen
k up generator functions :^) -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Help needed with Windows Service in Python

2010-09-02 Thread Mark Hammond
On 3/09/2010 1:22 AM, Ian Hobson wrote: Hi All, I am attempting to create a Windows Service in Python. I have the framework (from Mark Hammond and Andy Robinason's book) running - see below. It starts fine - but it will not stop. :( net stop "Python Service" and using the se

Re: Arguments from the command line

2010-09-06 Thread Mark Lawrence
://docs.python.org/library/sys.html Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-09 Thread Mark Lawrence
than you knowledge of Spanish :) Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Slice a list of lists?

2010-09-09 Thread Mark Lawrence
mplest way would be: [row[0] for row in a][::2] The fastest way to find out is probably typing at the interactive prompt. Just jump in at the deep end and see what happens. Then wait until someone tells you to use the timeit module. Cheers. Mark Lawrence. -- http://mail.python.org/mailma

Why does linecache avoid ? How can I get equivalent of inspect.getsource() for an interactive session?

2010-09-09 Thread Mark Hirota
Here's my goal: To enable a function for interactive session use that, when invoked, will "put" source code for a specified object into a plaintext file. Based on some initial research, this seems similar to ipython's %save magic command (?) Example: def put(filename, object): f = open(filen

Re: How Python works: What do you know about support for negativeindices?

2010-09-09 Thread Mark Tolonen
poverty.” —Groucho Marx | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list It came across fine for me (on much maligned Outlook Express, no less). -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: 32 bit bdist_wininst vs x64 platform

2010-09-10 Thread Mark Hammond
n x64 version of reportlab on a 32bit python? Mark -- http://mail.python.org/mailman/listinfo/python-list

Too many threads

2010-09-16 Thread mark . pelletier
For some reason, the tasks I put into my thread pool occasionally get run more than once. Here's the code: # --- from threading import Thread from queue import Queue import subprocess

Re: Too many threads

2010-09-17 Thread mark . pelletier
On Sep 17, 1:38 am, Ned Deily wrote: > In article <[email protected]>, >  Cameron Simpson wrote: > > > > > > > On 16Sep2010 22:14, Ned Deily wrote: > > | In article <[email protected]>, > > |  Cameron Simpson wrote: > > | > > | > On 16Sep2010 09:55, mar

Re: Too much code - slicing

2010-09-20 Thread Mark Lawrence
he hope of discouraging people to use it. I very much like the format of the Python ternary operator, but I've never actually used it myself :) Cheers Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Combinations or Permutations

2010-09-20 Thread Mark Lawrence
optimize my code here. Thanks in advance. Check the docs for the itertools module. Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: utf-8 and ctypes

2010-09-29 Thread Mark Tolonen
Pythonwin...US Windows console doesn't support Chinese): 我是美国人。 I used c_char_p instead of POINTER(c_char) and added functions to create and destroy a std::string for Python's use, but it is otherwise the same as your code. Hope this helps you work it out, -Mark -- http://mail.python.org/mailman/listinfo/python-list

How to convert a string into a list

2010-10-04 Thread Mark Phillips
ld be the best way to do this? I don't want to use eval, as the string is coming from an untrusted source. Thanks! Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a string into a list

2010-10-05 Thread Mark Phillips
Thanks to everyone for their suggestions. I learned a lot from them! Mark On Mon, Oct 4, 2010 at 11:54 PM, Chris Rebert wrote: > On Mon, Oct 4, 2010 at 10:33 PM, Arnaud Delobelle > wrote: > > MRAB writes: > >> On 05/10/2010 02:10, Mark Phillips wrote: > >>> I

Re: Can't find pythonwin

2010-10-10 Thread Mark Hammond
IDLE(GUI). Any suggestions where I can find it. I did a search on m pc and no luck. pythonwin comes with the pywin32 extensions - see http://sf.net/projects/pywin32. Cheers, Mark -- http://mail.python.org/mailman/listinfo/python-list

os.stat and strange st_ctime

2010-10-10 Thread Mark Jones
I've read the part about these being variable Note The exact meaning and resolution of the st_atime, st_mtime, andst_ctime members depends on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, st_mtimehas 2-second resolution, and st_ati

Re: How to display unicode char in Windows

2010-10-15 Thread Mark Tolonen
lt;%s>" % oo print u"**" Coding line declares *source* encoding, so Python can *decode* characters contained in the source. "print" will *encode* characters to the terminal encoding, if known. -Mark -- http://mail.python.org/mailman/listinfo/python-list

ANN: Shed Skin 0.6

2010-10-23 Thread Mark Dufour
example (around 2000 lines, sloccount). Please see my blog for the full announcement: http://shed-skin.blogspot.com Or go straight to the homepage: http://shedskin.googlecode.com Please have a look at the tutorial, try it out, and report issues at the homepage. Thanks, Mark Dufour -- http

Re: "Strong typing vs. strong testing" [OT]

2010-10-23 Thread Mark Wooding
Steven D'Aprano writes: > Well, what is the definition of pi? Is it: > > the ratio of the circumference of a circle to twice its radius; > the ratio of the area of a circle to the square of its radius; > 4*arctan(1); > the complex logarithm of -1 divided by the negative of the complex square > r

Re: [OFF] sed equivalent of something easy in python

2010-10-30 Thread Mark Wooding
Jussi Piitulainen writes: > Daniel Fetchinson writes: > > > The pattern is that the first line is deleted, then 2 lines are > > kept, 3 lines are deleted, 2 lines are kept, 3 lines are deleted, > > etc, etc. > > So, is there some simple expression in Python for this? (item for i, item in enumera

Re: Compare source code

2010-11-04 Thread Mark Wooding
quires different tools, and different techniques. Many languages use some kind of brackets to mark substructure, so tools have become good at handling bracketed substructure, whether for automatic indentation or navigation. Python marks (some) substructure differently, so users need t

Re: Compare source code

2010-11-04 Thread Mark Wooding
Tim Harig writes: > Python is the only language that I know that *needs* to specify tabs > versus spaces since it is the only language I know of which uses > whitespace formating as part of its syntax and structure. You need to get out more. Miranda, Gofer, Haskell, F#, make(1), and many others

Re: Allow multiline conditions and the like

2010-11-04 Thread Mark Wooding
Chris Rebert writes: > Or, if possible, refactor the conditional into a function (call) so > it's no longer multiline in the first place. No! This /increases/ cognitive load for readers, because they have to deal with the indirection through the name. If you actually use the function multiple

Re: Compare source code

2010-11-04 Thread Mark Wooding
Tim Harig writes: > So, your telling me that mixing tabs and spaces is considered a good > practice in Haskell? It doesn't seem to be a matter which is discussed much. I think Haskell programmers are used to worrying their brains with far more complicated things like wobbly[1] types. > I would

Re: Man pages and info pages

2010-11-04 Thread Mark Wooding
Tim Harig writes: > When the GNU folk decided to clone *nix they decided that they knew > better and simply decided to create their own interfaces. This isn't the case. Actually Info has a long history prior to GNU: it was the way that the documentation was presented at the MIT AI lab. In fact

Re: Ways of accessing this mailing list?

2010-11-04 Thread Mark Wooding
John Bond writes: > Hope this isn't too O/T - I was just wondering how people read/send to > this mailing list, eg. normal email client, gmane, some other software > or online service? > > My normal inbox is getting unmanageable, and I think I need to find a > new way of following this and other

Re: Compare source code

2010-11-04 Thread Mark Wooding
Tim Harig writes: > I use simple comments that are not effected by white space. I don't > waste my time trying to make comments look artistic. They are there > to convey information; not to look pretty. I really detest having to > edit other peoples comment formatting where you have to re-alig

Re: functions, list, default parameters

2010-11-04 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message <[email protected]>, Andreas > Waldenburger wrote: > > While not very commonly needed, why should a shared default argument be > > forbidden? > > Because it’s safer to disallow it than to allow it. Scissors with rounded ends are saf

Re: functions, list, default parameters

2010-11-04 Thread Mark Wooding
Lawrence D'Oliveiro writes: > Mediocre programmers with a hankering towards cleverness latch onto it > as an ingenious way of maintaing persistent context in-between calls > to a function, completely overlooking the fact that Python offers much > more straightforward, comprehensible, flexible, an

Re: Man pages and info pages

2010-11-04 Thread Mark Wooding
Tim Harig writes: > Right, and in info with the default key bindings, backspace takes me > to the command help. I would have expected it to either scroll up the > page or take me to the previously visited node. Sounds like your terminal is misconfigured. Backspace should produce ^?, not ^H. (

Re: functions, list, default parameters

2010-11-05 Thread Mark Wooding
Steven D'Aprano writes: > defaults initialise on function definition (DID) > defaults initialise on function call (DIC) > > I claim that when designing a general purpose language, DID (Python's > existing behaviour) is better than DIC: > > #1 Most default values are things like True, False, None

Re: Compare source code

2010-11-06 Thread Mark Wooding
Rustom Mody writes: > As for tools' brokeness regarding spaces/tabs/indentation heres a > thread on the emacs list wherein emacs dev Stefan Monnier admits to > the fact that emacs' handling in this regard is not perfect. > > http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/1bd0c

Re: functions, list, default parameters

2010-11-06 Thread Mark Wooding
Steven D'Aprano writes: > On Fri, 05 Nov 2010 12:17:00 +0000, Mark Wooding wrote: > > Right; so a half-decent compiler can notice this and optimize > > appropriately. Result: negligible difference. > > Perhaps the biggest cost is that now your language has incon

Re: functions, list, default parameters

2010-11-06 Thread Mark Wooding
Dennis Lee Bieber writes: > On Sat, 06 Nov 2010 12:37:42 +, [email protected] (Mark Wooding) > declaimed the following in gmane.comp.python.general: > > > > > Two reasons. Firstly, this comes from my Lisp background: making a > > list is the obvious way

Re: How to test if a module exists?

2010-11-06 Thread Mark Wooding
Chris Rebert writes: > if err.message != "No module named extension_magic_module": Ugh! Surely this can break if you use Python with different locale settings! -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-06 Thread Mark Wooding
Chris Rebert writes: > Since when does Python have translated error messages? It doesn't yet. How much are you willing to bet that it never will? ;-) -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

Re: Silly newbie question - Carrot character (^)

2010-11-06 Thread Mark Wooding
Steven D'Aprano writes: > If you want to argue that the Python reference manual is aimed at the > wrong level of sophistication, specifically that the BNF syntax stuff > should be ripped out into another document, then I might agree with > you. But to argue that it's entirely the wrong "kind" of

Re: Compare source code

2010-11-07 Thread Mark Wooding
Lawrence D'Oliveiro writes: > I would never do that. “Conserving vertical space” seems a stupid reason for > doing it. Vertical space is a limiting factor on how much code one can see at a time. I use old-fashioned CRT monitors with 4x3 aspect ratios and dizzyingly high resolution; I usually w

Re: Silly newbie question - Carrot character (^)

2010-11-07 Thread Mark Wooding
Nobody writes: > You're taking "how" too literally, so let me rephrase that: > > A reference manual tells you what you need to know in order to use > the language. A specification tells you what you need to know in > order to implement it. I still don't see those as being different. A lan

Re: Allowing comments after the line continuation backslash

2010-11-07 Thread Mark Wooding
Lawrence D'Oliveiro writes: > Not surprising, since the above list has become completely divorced from its > original purpose. Anybody remember what that was? It was supposed to be used > in a loop, as follows: > > for \ > Description, Attr, ColorList \ > in \ > ( >

Re: Popen Question

2010-11-08 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message , Chris Torek wrote: > > > ['/bin/sh', '-c', 'echo', '$MYVAR'] > > > > (with arguments expressed as a Python list). /bin/sh takes the > > string after '-c' as a command, and the remaining argument(s) if > > any are assigned to positional parameters (

Re: populating a doubly-subscripted array

2010-11-08 Thread Mark Wooding
[email protected] writes: > What am I missing? I am using Python 3.1.2. > > ff = [[0.0]*5]*5 > ff#(lists 5x5 array of 0.0) > for i in range(5): > for j in range(3): > ff[i][j] = i*10+j > print (i,j,ff[i][j]) # correctly prints ff array values > > ff

Re: Pythonic/idiomatic?

2010-11-09 Thread Mark Wooding
Seebs writes: > ' '.join([x for x in target_cflags.split() if re.match('^-[DIiU]', x)]) > > This appears to do the same thing, but is it an idiomatic use of list > comprehensions, or should I be breaking it out into more bits? It looks OK to me. You say (elsewhere in the thread) that you'

Re: Compare source code

2010-11-09 Thread Mark Wooding
Arnaud Delobelle writes: > python-mode has python-beginning-of-block (C-c C-u) and > python-end-of-block. Yes. It was one of my explicit gripes that editing Python requires one to learn entirely new and unfamiliar keystrokes for doing fairly familiar editing tasks. -- [mdw] -- http://mail.pyt

Re: functions, list, default parameters

2010-11-09 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message , Robert Kern > wrote: > > So examining LHS "selectors" is not sufficient for determining > > immutability. > > Yes it is. All your attempts at counterexamples showed is that it is not > necessary, not that it is not sufficient. You've got them the wron

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Mark Wooding
Philip Semanchuk writes: > What's funny is that I went looking for a printed copy of the C > standard a few years back and the advice I got was that the cheapest > route was to find a used copy of Schildt's "Annotated ANSI C Standard" > and ignore the annotations. So it serves at least one useful

Re: subclassing str

2010-11-09 Thread Mark Wooding
rantingrick writes: > One thing i love about Python is the fact that it can please almost > all the "religious paradigm zealots" with it's multiple choice > approach to programming. However some of the features that OOP > fundamentalists hold dear in their heart are not always achievable in > a c

Re: populating a doubly-subscripted array

2010-11-09 Thread Mark Wooding
Gregory Ewing writes: > A reasonably elegant way to fix this is to use list comprehensions > for all except the innermost list: > >ff = [[0.0]*5 for i in xrange(5)] Yes, this is a good approach. I should have suggested something like this as a solution myself, rather than merely explaining

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message <[email protected]>, Mark Wooding > wrote: > > for descr, attr, colours in [ > > ('normal', 'image','Normal'), > > ('highlighted

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Mark Wooding
Tim Chase writes: > On 11/09/10 18:05, Robert Kern wrote: > > For me, putting the brackets on their own lines (and using a > > trailing comma) has little to do with increasing readability. It's > > for making editing easier. > > It also makes diff's much easier to read (my big impetus for doing t

<    49   50   51   52   53   54   55   56   57   58   >