Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Rhodri James
ge extensions to communicate the necessary info to the external tool. Or, dare one say it, conventions? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Rhodri James
On Thu, 15 Jan 2009 03:54:02 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: "Rhodri James" writes: > Again, there have to be some language extensions to communicate the > necessary info to the external tool. Or, dare one say it, conventions? If

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-15 Thread Rhodri James
actually want to write is the script that scans your C data structure and spits out a Python class or module that implements it with whatever degree of checking you want. That should make writing your actual data munger safer and faster, if I'm understanding you correctly. -- Rhodri Jame

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-15 Thread Rhodri James
da/ada-vs-c/cada_art.html I agree. I suspect that its more the case that once most programmers have been taught how to use the hammer that is C, all problems look like nails. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: reading file to list

2009-01-19 Thread Rhodri James
tirely the reverse. List comprehension is actually quite a linguistically natural way to express the iterative construction of a list. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: A java hobbyist programmer learning python

2009-01-19 Thread Rhodri James
r = sys.argv[1] self.arg1 = int(sys.argv[2]) self.arg2 = int(sys.argv[3]) If you want the test code to work, I think you mean: def __init__(self, op, arg1, arg2): self.operator = op self.arg1 = arg1 self.arg2 = arg2 :) -- Rhodri James *-* Wildebeeste Herd

Re: Two questions about style and some simple math

2009-01-19 Thread Rhodri James
ibute names (sorry, the terminology crossover is inherently confusing) so much? Unless you think there's a serious danger of trying to add new character attributes on the fly, I think it's overkill. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Two questions about style and some simple math

2009-01-20 Thread Rhodri James
On Tue, 20 Jan 2009 02:11:24 -, Mensanator wrote: On Jan 19, 7:44 pm, "Rhodri James" wrote: Surely in any case you don't want an expression based on the difference, since that would give you the same chance of having the first attack no matter what the levels of courag

Re: reading file to list

2009-01-20 Thread Rhodri James
On Tue, 20 Jan 2009 03:39:45 -, Xah Lee wrote: On Jan 19, 4:49 pm, "Rhodri James" wrote: On Sun, 18 Jan 2009 08:31:15 -, Xah Lee wrote: > On Jan 17, 10:25 am, Tino Wildenhain wrote: >> > [[int(x) for x in line.split()] for line in open("blob.txt"

Re: pep 8 constants

2009-01-20 Thread Rhodri James
distinction through CONVENTIONAL_NAMING_PRACTICE is useful. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: what's the point of rpython?

2009-01-20 Thread Rhodri James
which is a lot harder to find. Even if you could find a platform supporting it, it doesn't help you on other platforms you may need to run on. Just do the locking properly and worry about optimisations later. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: what's the point of rpython?

2009-01-20 Thread Rhodri James
On Wed, 21 Jan 2009 02:29:01 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: "Rhodri James" writes: > What cpu's do you know of that can atomically increment and decrement > integers without locking? x86 (and pretty much any 8080 derivative,

Re: reading file to list

2009-01-20 Thread Rhodri James
is a good thing (my personal list places more emphasis on the theory and practice of music, theology, literature and democracy, but anything is fair game), expanding one's ego is not. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: what's the point of rpython?

2009-01-20 Thread Rhodri James
On Wed, 21 Jan 2009 05:37:44 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: "Rhodri James" writes: In that case I'd second the suggestion of taking a long, hard look at the Linux core locking and synchronisation primatives. Do you understand wha

Re: reading file to list

2009-01-21 Thread Rhodri James
On Wed, 21 Jan 2009 09:42:19 -, Lars Behrens wrote: Rhodri James wrote: I *was* thinking of code produced in the real world, and I don't buy your assertion. I'm not an academic, and I wouldn't hesitate to lay down a line of code like that. As I said before, it fi

Re: reading file to list

2009-01-21 Thread Rhodri James
On Wed, 21 Jan 2009 09:13:03 -, Xah Lee wrote: Rhodri James wrote: I recommend spending less time being certain that you are correct without seeking evidence I don't concur. For instance, when you are talking to a bunch of kids, you have to be sure of yourself, else they run all

Re: unzip array of arrays?

2009-01-22 Thread Rhodri James
ready exists, there's always a list comprehension: [field(l) for l in a] If you want that specific list: [l[1] for l in a] [2, 4, 6] -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: What is intvar?

2009-01-22 Thread Rhodri James
; button is the one selected). Similarly self.colorVar.set(n) selects whichever radio button has the "value" which matches n (so self.colorVar.set(2) selects the "Pseudo Color" button). IntVar and StringVar (and DoubleVar if you must :-) are basically the easy way of dynamically

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Rhodri James
any of the good dance clubs), I'd have been better off taking a hacksaw to the internals myself and presenting my fix for Fred's consideration. Python allows me to do this without the fuss and drama that strict encapsulation seems to posit is necessary, instead of delaying an entire release

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Rhodri James
roadblock. Under those circumstances you have three choices: 1) defeat the data hiding by talking to Fred directly; 2) defeat the data hiding by hacking away yourself and getting Fred's forgiveness later; 3) give up. See, we're back on topic! -- Rhodri James *-* Wildebeeste Herder to th

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-24 Thread Rhodri James
On Sun, 25 Jan 2009 00:31:14 -, Tim Rowe wrote: 2009/1/24 Rhodri James : My experience with medium-sized organisations (50-100 people) is that either you talk to Fred directly, or it doesn't happen. In particular the more people (especially PHBs) that get involved, the slowe

Re: Exec woes

2009-01-28 Thread Rhodri James
t, arg 1 is a tuple of two elements, "somestring to execute" in globals() and locals() which is also unlikely to be what you want. Neither of these are giving you a string, file or code object, exactly as the interpreter is telling you. -- Rhodri James *-* Wildebeeste Herder to the Masses -- h

Re: Exec woes

2009-01-29 Thread Rhodri James
On Thu, 29 Jan 2009 08:15:57 -, Hendrik van Rooyen wrote: "Rhodri James" wrote: To: Sent: Thursday, January 29, 2009 6:12 AM Subject: Re: Exec woes On Wed, 28 Jan 2009 07:47:00 -, Hendrik van Rooyen wrote: > This is actually not correct - it is the root cause

Re: is python Object oriented??

2009-02-01 Thread Rhodri James
On Sun, 01 Feb 2009 17:31:27 -, Steve Holden wrote: Stephen Hansen wrote: [...] don't play with anyone else's privates. A good rule in life as well as programming. Unless, of course, you're both consenting adults. What? Someone had to say it! -- Rhodri James

Re: Question about wx folder browser widget

2009-02-02 Thread Rhodri James
operations on it. Wanted to check first to see if something exists, and not reinvent the wheel. There's TreeCtrl, and CustomTreeCtrl. I don't know whether they can be used with drag and drop, Yes they can, at least after a fashion. See http://wiki.wxpython.org/TreeControls -- Rh

Re: is python Object oriented??

2009-02-02 Thread Rhodri James
uch harder (though by no means impossible) to break language-enforced hiding when (not if) an interface turns out to be inadequate. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading text file with wierd file extension?

2009-02-02 Thread Rhodri James
xed the typo. DataFH and ResourceFH are both local variables to __init__ and will be tossed away when it finishes executing. If you want to use them later, make them self.data_fh and self.resource_fh respectively. (PEP 8 recommends that you use lower_case_with_underscores for variable or attribute names, and leave MixedCase for class names.) -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: key capture

2009-02-02 Thread Rhodri James
probably w/o luck because afaik there is no way to track the event of having random keys pressed the same time. Yes there is. You need to use one of the GUIs (Tkinter, wxPython, PyGame, etc), all of which will give you Key Down/Key Up events. -- Rhodri James *-* Wildebeeste Herder to the Masses

Re: is python Object oriented??

2009-02-02 Thread Rhodri James
it's that trivial to defeat something that its proponents appear to want to be close to an iron-clad guarantee, what on earth is the point of using "private" in the first place? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: is python Object oriented??

2009-02-03 Thread Rhodri James
On Tue, 03 Feb 2009 05:37:57 -, Russ P. wrote: On Feb 2, 7:48 pm, "Rhodri James" wrote: On Tue, 03 Feb 2009 02:16:01 -, Russ P. wrote: > Here we go again. If you have access to the source code (as you nearly > always do with Python code), then "breaking the l

Re: is python Object oriented??

2009-02-03 Thread Rhodri James
den volte face and declared that it was trivial to circumvent. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: is python Object oriented??

2009-02-03 Thread Rhodri James
On Wed, 04 Feb 2009 01:13:32 -, Russ P. wrote: On Feb 3, 4:05 pm, "Rhodri James" wrote: I'm very much of the second opinion; it was Russ who did the sudden volte face and declared that it was trivial to circumvent. Whoa! Hold on a minute here. Your failure to understan

Re: Use list name as string

2009-02-04 Thread Rhodri James
#x27;t assigned to a name somehow), or just as easily one or many names. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Feet and inches

2009-02-04 Thread Rhodri James
What condition is "a height less than 1/2 inch" in terms of your program? (Hint: the condition isn't what I think you think it is -- remember that "inches" is an int!) How can I also take into account all the cases that need an exception? How do you take care of any exception? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Use list name as string

2009-02-04 Thread Rhodri James
e the traditional name to use. So: def demo(action, **kwargs): ... print kwargs ... demo(action="dummy", text="wombats are go") {'text': 'wombats are go'} You can also use it the other way round to expand a dictionary into keyword parameters to a function call: myargs = { 'action': 'avoid', 'where': 'Camelot', 'because': 'it is a silly place' } demo(**myargs) {'because': 'it is a silly place', 'where': 'Camelot'} -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: where clause

2009-02-05 Thread Rhodri James
20 / len(c) b = foo(d) or even: where: a = 20 / len(c) b = foo(d) do: p = a / b Effectively you're creating a little local namespace for temporary variables. I'm not sure it buys you a lot, even as sugar, and I'm really not convinced by the bypartite form, but it's d

Re: Use list name as string

2009-02-05 Thread Rhodri James
The name of the object is a name. It doesn't really exist as an object at all. As others have said, if you really want this information you'll need to write your own class with a "name" attribute, and assign a suitable string to it. -- Rhodri James *-* Wildebeeste Herder to t

Re: return multiple objects

2009-02-05 Thread Rhodri James
les are optional, except for a couple of cases where you *have* to put them in to avoid ambiguity. I tend to put them in always, but leaving them out in cases like this seems to be normal practice.) -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file character by character

2009-02-10 Thread Rhodri James
() except it is significantly slower and harder to read. Neither deal with quoted text, apostrophes, hyphens, punctuation or any other details of real-world text. That's what I mean by "simple-minded". You're missing something :-) Specifically, the punctuation gets swept

Re: re.sub and named groups

2009-02-11 Thread Rhodri James
tring methods, and string interpolation! So the moral of this story is take a ball of strings with you for when you get lost in regular expressions. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: select.poll.poll() never blocks

2009-02-11 Thread Rhodri James
to do it in Python, the only thing that springs to mind is periodically checking the size of the file and reading more when that changes. You'll need to be very careful to keep what size you think the file is in sync with how much you've read! -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with objects copying each other in memory

2009-02-12 Thread Rhodri James
creating a new list. a = [1, 2, 3] b = a a.append(4) print b Here, the list has both labels 'a' and 'b' attached to it. When we call a.append, it doesn't create a new list or anything like that, it just makes the existing list larger and tacks the

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-12 Thread Rhodri James
On Thu, 12 Feb 2009 16:44:56 -, W. eWatson wrote: I simply ask, "How do I get around the problem?" Run your program from the command line, or by double-clicking. You've been told this several times now. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-12 Thread Rhodri James
. I then went to another machine that has never had pythonWin on it all, but does have python 2.5.2 with IDLE. I ran the same program there. W2K. In both cases, I got the output below. Your conclusions? That you haven't listened to a word anyone has said. -- Rhodri James *-* Wildebeeste H

Re: Scanning a file character by character

2009-02-12 Thread Rhodri James
plit("(\w+)", "The quick brown fox jumps, and falls over.")[1::2] ['The', 'quick', 'brown', 'fox', 'jumps', 'and', 'falls', 'over'] Using this code how would it load each word into a temporary var

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-13 Thread Rhodri James
igit, I can easily find myself executing an earlier version, differing as Dev4, to Dev5 at the end of each name. I'd suggest spending a while reading up on version control systems. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Untangling pythonWin and IDLE Processes on XP Pro

2009-02-14 Thread Rhodri James
On Sat, 14 Feb 2009 05:03:13 -, W. eWatson wrote: See my response to Scott. Thanks for your reply. I did. It was fundamentally mistaken in so many respects that I formally give up on you. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo

Re: Referencing resources from python

2009-02-16 Thread Rhodri James
cur to me... What do you recommend? It rather depends on what the files are. Some (clearly not this) will be best coded as absolute paths. Probably your best bet otherwise is to set an environment variable outside Python to point to the appropriate directory, and read it out of the os.e

Re: how to assert that method accepts specific types

2009-02-20 Thread Rhodri James
this is to gratuitously subclass Test: class AcceptableTest(object): pass class Test(AcceptableTest): @accepts(int, AcceptableTest) def check(self, obj): print obj -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't you just love writing this sort of thing :)

2008-12-06 Thread Rhodri James
ing, "pretty" and "clever" will not be the words you are using. Trust me on this one. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: python book for non technical absolute beginner

2008-12-06 Thread Rhodri James
al. Caveat: the worksheets are built around Python 2.x (for small values of x!), tell your friend not to use Python 3.0. This is one of the few cases where it really matters that 'print' is now a function; nothing freaks a beginner like his output not behaving the way he's been to

Re: Guido's new method definition idea

2008-12-06 Thread Rhodri James
sing, or at least not more than momentarily. I'm -0 on this at the moment. Maybe -0.5. I don't really like the potential for hideousness like @staticmethod def spam.alot(isa, silly, place): return silly + spam that's implied by making this a general feature of

Re: Don't you just love writing this sort of thing :)

2008-12-07 Thread Rhodri James
On Sun, 07 Dec 2008 07:27:51 -, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: In message <[EMAIL PROTECTED]>, Rhodri James wrote: Yes, it's very pretty, and you're terribly clever. In six months' time when you come back to make some engineering change a

Re: Python for kids?

2008-12-07 Thread Rhodri James
python-list The LiveWires Python Course, http://www.livewires.org.uk/python/home is aimed at your son's age-group. There are several worksheets that involve building games using a simple veneer over pygame, if you need to entice him with something! -- Rhodri James *-* Wildebeeste Herder to th

Re: Rich Comparisons Gotcha

2008-12-09 Thread Rhodri James
as to make it clear why it wasn't the same as __eq__, otherwise you end up with the confusion that the Perl "==" and "eq" operators regularly cause. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: How to pass out the result from iterated function

2008-12-10 Thread Rhodri James
'list'? You try assigning 'output' to 'final_out' with no guarantee that 'output' has ever been assigned to. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-11 Thread Rhodri James
nd nothing else, so you don't have to worry about losing leading or trailing spaces if those are important to you. ... and it's so hard to write item = item[:-1] Tsk. That would be "chop". "chomp" would be if item[-1] == '\n': item = i

Re: newbie question: if var1 == var2:

2008-12-11 Thread Rhodri James
On Thu, 11 Dec 2008 23:49:10 -, John Machin wrote: On Dec 12, 10:31 am, "Rhodri James" wrote: On Thu, 11 Dec 2008 19:49:23 -, Steve Holden   wrote: > ... and it's so hard to write >      item = item[:-1] Tsk.  That would be "chop".  "chom

Re: sorting for recursive folder rename

2008-12-16 Thread Rhodri James
ctory creation so you don't even need to sort the list. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Rhodri James
|self| in |b| is still in lexical scope, though. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: noob trouble with IDLE

2008-12-22 Thread Rhodri James
avoiding using IDLE's "Run Module" for anything but the most straightforward Python code. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: iterating initalizations

2008-12-22 Thread Rhodri James
m still not terribly clear as to why you need so many. Is each list intended for a different instrument, so you're more looking at: violin_1 = [ ...stuff... ] violin_2 = [ ...other stuff...] viola = [ ...really sweet stuff... ] cello = [ ...really boring stuff... ] -- Rhodri James *-*

Re: Python's popularity

2008-12-22 Thread Rhodri James
On Tue, 23 Dec 2008 04:35:42 -, Grant Edwards wrote: IIRC, Python came pre-installed on my IBM Thinkpad. However, it wasn't anyplace the average user would stumble across it... The suggestively named "IBMTOOLS" directory, I believe :-) -- Rhodri James *-* Wildebeest

Re: iterating initalizations

2008-12-23 Thread Rhodri James
nd __B are full of zeroes, then you should suspect your notes.pitchTwist() and rhythm.rhythmTwist() methods of returning zeroes. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2009-01-05 Thread Rhodri James
n. Every other language I use (yes, including C) I learned afterwards. Moral: times change. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2009-01-07 Thread Rhodri James
bject into a labelled box" model when working with other languages. I don't know why this should be, but it is. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store passwords?

2009-01-07 Thread Rhodri James
kind of secured protocol instead? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: "import" not working?

2009-02-23 Thread Rhodri James
le it: sys.path.append("C:\\DataFileTypes") IMHO, Python is somewhat inconsistent in not producing a compile-type error (or at least an annoying compile-time warning) when presented with invalid escape sequences. What it does, even though it's well-documented and usually the right gu

Re: more on unescaping escapes

2009-02-23 Thread Rhodri James
Files\test" "\P" isn't a valid escape sequence, so it doesn't get replaced. "\t" represents a tab, so it does. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: more on unescaping escapes

2009-02-23 Thread Rhodri James
On Tue, 24 Feb 2009 00:26:29 -, bvdp wrote: So, in this case I'm assuming that the interpreter is converting the escapes on assignment. The compiler converts the escapes on creating its internal representation of the string, before assignment ever gets involved. -- Rhodri

Re: Python AppStore / Marketplace

2009-02-23 Thread Rhodri James
ill) speak English (of a kind). A souq is a bazaar :-) Well, close enough anyway. It's another arabic word that translates as "market" in both the mercantile and financial senses, I believe. Maybe I've just read too much arabic-themed fiction, but I was surprised not to find

Re: thanks very much indeed for your help is there a better way to do this (python3) newby

2009-02-23 Thread Rhodri James
what you write in the rest of the code. In this case you call your input string "items", but then say "Join all the strings in *stringList*..." -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: more on unescaping escapes

2009-02-24 Thread Rhodri James
d be done with it. Of course I still need to use \x20 for spaces, but that is easy. Erm, no. "\x20" is exactly the same as " " in a string literal. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: pep 8 constants

2009-02-25 Thread Rhodri James
d out this wasn't already the case - I would have sweared it was. It is. Aahz added it a few weeks ago. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-26 Thread Rhodri James
. It should be trivial to calculate all the different new trees that are one digit longer than a previous tree. Trivial yes, but the number of different new trees is large when you're dealing with four digits, and ridiculous with 5. -- Rhodri James *-* Wildebeeste Herder to the Masses --

Re: why cannot assign to function call

2009-02-27 Thread Rhodri James
unc(foo)# bar is new name for foo With true pass-by-value, this comment is not true. Bar would be a copy of foo, not a new name. What happens to bar is then not reflected in foo (depending on how deep the copy is), which is the objective of pass-by-value. -- Rhodri James

Re: what does this mean....?

2009-02-27 Thread Rhodri James
your code to make sense of it would have helped. Without context, my best guess is that "localFileName" isn't actually a string. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a General Method to Configure Tkinter Widgets

2009-03-03 Thread Rhodri James
lly wise, and I'm failing. If you absolutely must prat around with indirections like this, wouldn't s = getattr(dialog, variable_containing_the_string_stopV).get() be a much less unsafe idea? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie - pass variable to cscript

2009-03-03 Thread Rhodri James
T /msg:hello ' + vBS) Your problem is that vBS has a space in it, so the Windows command interpreter is interpreting it as two separate arguments, r"C:\Program" and r"Files\nasa\nmail.vbs". Gabriel has already posted two solutions (which I won't repeat), but he forg

Re: Question about binary file reading

2009-03-04 Thread Rhodri James
x(ord(b)) Does that look more like what you were expecting? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about binary file reading

2009-03-04 Thread Rhodri James
On Wed, 04 Mar 2009 23:28:32 -, Tino Wildenhain wrote: Rhodri James wrote: On Wed, 04 Mar 2009 22:58:38 -, vibgyorbits wrote: I'm writing a tool to do some binary file comparisons. I'm opening the file using fd=open(filename,'rb') # Need to seek to 0x80

Re: help understanding class or function

2009-03-05 Thread Rhodri James
n it depends on what your function is supposed to be doing. If it's changing every element of the list, doing the changes in-place should be a doddle. If it's filtering some elements out (like your example of omitting every other element) then it's much easier to build a new lis

Re: create boolean

2009-03-06 Thread Rhodri James
= (n is not None) and (n != []) The second comparison isn't actually necessary, since an empty list is True and a non-empty one False. b = (n is not None) and n Putting the comparison in does make the code slightly less "magic", though, so it's not a bad idea to

Re: create boolean

2009-03-08 Thread Rhodri James
On Sat, 07 Mar 2009 05:03:08 -, Grant Edwards wrote: On 2009-03-07, Rhodri James wrote: On Fri, 06 Mar 2009 15:34:08 -, Grant Edwards wrote: On 2009-03-06, Fencer wrote: Hi, I need a boolean b to be true if the variable n is not None and not an empty list, otherwise b should

Re: A Dangling Tk Entry

2009-03-09 Thread Rhodri James
g to prove anything. Now if you were to show us a line like "something = dialog.body(something_else)" then you might be onto something, but personally I suspect you're going to find that rather hard. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: A Dangling Tk Entry

2009-03-10 Thread Rhodri James
On Tue, 10 Mar 2009 12:41:07 -, W. eWatson wrote: [snippety snip] Rhodri James wrote: > You're misunderstanding. The line that you arrowed above has absolutely > nothing whatsoever to do with the method "body()", so keeping on showing > us ever full

Re: Behaviour of os.rename()

2009-03-11 Thread Rhodri James
ending "\\?\" Tim's point was that you should read the MS documentation. To be fair it doesn't mention doing a copy and (failing to) delete instead of moving the file when doing cross-volume renames, but that's what the OS will have to do. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: A Dangling Tk Entry

2009-03-13 Thread Rhodri James
entry.insert(0,self.slowdown) <--- no affect. Erm, no. You stated (and showed us the code) that it was entry = Entry(master,...).grid(...) *big* difference, and entry.insert(0, self.slowdown) *raises an exception*, which is a long way from having no effect. -- Rhodri James *-* Wildebe

Re: Special keyword argument lambda syntax

2009-03-13 Thread Rhodri James
would add confusion rather than remove it. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Special keyword argument lambda syntax

2009-03-14 Thread Rhodri James
On Fri, 13 Mar 2009 16:39:16 -, Scott David Daniels wrote: The original proposal was initially appealing to me until I saw this comment. That means a relatively "invisible typo" would turn into good syntax. Possibley this is exactly what Rhodri James is talking about, but

Re: Special keyword argument lambda syntax

2009-03-14 Thread Rhodri James
On Fri, 13 Mar 2009 15:33:26 -, MRAB wrote: Rhodri James wrote: On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky wrote: Specification = Allow keyword arguments in function call to take this form: NAME ( ARGUMENTS ) = EXPRESSION which is equivallent to the

Re: Style question - defining immutable class data members

2009-03-15 Thread Rhodri James
ht, Gary's assumption of less understanding rather than more is clearly the safer one to take. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Style question - defining immutable class data members

2009-03-15 Thread Rhodri James
On Sun, 15 Mar 2009 15:05:04 -, Matthew Woodcraft wrote: "Rhodri James" writes: On Sun, 15 Mar 2009 13:26:17 -, Matthew Woodcraft It seems clear to me that Maxim understood all this when he asked his original question (you need to understand this subtlety to know why

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread Rhodri James
'd much rather fix the locale system and extend the format syntax to override the default locale. Perhaps something like financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:financial}".format(1234567)) It's hard to think of a way of exten

Re: Style question - defining immutable class data members

2009-03-15 Thread Rhodri James
stance" there :-) Actually what I want is for the attribute to be stored where I told it, which could well be in the class. If the attribute is specified as "self.attribute", then yes, put it in the instance. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread Rhodri James
On Sun, 15 Mar 2009 19:00:43 -, MRAB wrote: Rhodri James wrote: [snip] Frankly, I'd much rather fix the locale system and extend the format syntax to override the default locale. Perhaps something like financial = Locale(group_sep=",", grouping=[3]) print(&

Re: Style question - defining immutable class data members

2009-03-15 Thread Rhodri James
On Sun, 15 Mar 2009 23:26:04 -, Aaron Brady wrote: On Mar 15, 1:50 pm, "Rhodri James" wrote: On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady   wrote: > On Mar 15, 12:39 pm, John Posner wrote: >> (My apologies if the thread has already covered this.) I believe I

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread Rhodri James
this, but how about: print("my number is {fin.format("10d", {0}, True)}".format(1235467, fin=financial)) assuming the locale.format() method remains unchanged? That's horrible, and I'm pretty sure it can't be right, but I'm too tired to thin

Re: Style question - defining immutable class data members

2009-03-16 Thread Rhodri James
class. I blame having two hours of sleep in three days for this particular bit of dimness, sorry. P.S. Do you pronounce 'wildebeeste' like 'vildebeeste'? No, with a "w" not a "v". It's just one of those titles that stick with you no matter what y

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread Rhodri James
local locales (!) wouldn't be so hard later on. Anyway, time I stopped hypothesising about locales and started looking at the actual code-base, methinks. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   >