Re: Uses of a deprecated module 'string'

2010-06-22 Thread James Mills
string constants which obviously still exists. I believe it's the use of said "functions" from the old "string" module that are deprecated. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Rhodri James
I do recall a number of occasions on which "r" blathered on in a manner that could be mistaken for those things if one didn't actually read what was written. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Rhodri James
linear-flow" than the two code snippets i provided earlier, hmmm? You did rather carefully pick an example where Python's syntax flow the other way round and then present all the least Pythonic paraphrases of the Ruby functional approach. -- Rhodri James *-* Wildebeeste Herder to t

Re: Should I Learn Python or Ruby next?

2010-06-24 Thread Rhodri James
On Wed, 23 Jun 2010 23:47:55 +0100, rantingrick wrote: On Jun 23, 4:43 pm, "Rhodri James" wrote: > And how exactly does your example express itself in a more > "syntactically-correct" "linear-flow" than the two code snippets i > provided earlier,

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Rhodri James
done), but then again it was never meant to be. C was like that once. In the 1970s, all you could return was an "int" or a "float". But that got fixed. Strangely, these facts are not unconnected. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespace problem?

2010-07-01 Thread Rhodri James
nother artistic interpretation of a photograph of your code :-), then I'd go with Matt's analysis. This will give you a NameError for fws_last_col if tracker.hasFWS() happens to return False for all students. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing a callback function as a class member

2010-07-07 Thread Rhodri James
t;) Hello, world Works for me. Which version of Python are you using? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Only one forum app in Python?

2010-07-09 Thread James Mills
On Fri, Jul 9, 2010 at 6:18 PM, Gilles Ganault wrote: > Is Pocoo really the only solution available out there? Did you bother to check pypi ? cheers James 1. http://pypi.python.org/ -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/li

Re: Hello

2010-07-09 Thread Rhodri James
few different editors out and see what style you like. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Only one forum app in Python?

2010-07-12 Thread James Mills
not a forum, but it's goals are to have a best-of-mix of features from blogging, wiki and cms engines. cheers James 1. http://sahriswiki.org/ -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy questions from a python beginner

2010-07-12 Thread Rhodri James
could be right; x exists, but Python pretends it doesn't until it's assigned to. CPython, not Python. And as Steven said, x *doesn't* exist. Allowance is made by that specific implementation of the interpreter because x *might* exist, but in this particular case it doesn&#

Re: [ann] Hatta 1.4.0 wiki engine released

2010-07-21 Thread James Mills
On Wed, Jul 21, 2010 at 6:01 PM, Radomir Dopieralski wrote: > I'm proud to announce release 1.4.0 of Hatta wiki engine. Congrats. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: how to prevent the "extended call syntax" (*) from expanding a string into a list of characters

2010-07-21 Thread James Mills
On Thu, Jul 22, 2010 at 4:26 PM, fulv wrote: >  args = (connection_string) Replace this with: args = (connection_string,) NOTE: The trailing , (comma) indicating that this _is_ a tuple. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.pytho

Re: Where is the man page of python library

2010-07-23 Thread James Mills
On Sat, Jul 24, 2010 at 1:42 AM, rantingrick wrote: > In the land of the blind, the one eyed man is king! ;-) RIck, your comments don't really help the situation. Really. -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: python terminology on classes

2010-07-26 Thread Rhodri James
o all your questions are section 9 of the tutorial. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: How to capture all the environment variables from shell?

2010-07-26 Thread Rhodri James
.@gnudebst:~$ HELLO=world rho...@gnudebst:~$ echo $HELLO world rho...@gnudebst:~$ export HELLO rho...@gnudebst:~$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more infor

Re: Trying to run Python 2.7 on Windows 7 and any suggestions on books/websites for "dummies guide to python" type learning

2010-08-02 Thread James Mills
here i can find/get > something similar to the book for my own? Start with the mighty fine Python tutorial on the Python Documentation website (1) cheers James 1. http://docs.python.org/ -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: web and standalone access

2010-08-03 Thread James Mills
imenting myself with embedded circuits.web with pygtk and webkit with some success (similar to Adobe Air). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
ot;automated clean-up side of the RAIL idiom" ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL

2010-08-03 Thread James Mills
p me and let me know that how can I convert/save .xpm > files in PIL. > Reading PIL's documentation might help. Try: $ pydoc Image cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 7:04 PM, Steven D'Aprano wrote: > True, but Nobody said it can't *readily* be implemented, not that it > can't be. So he did too :) I read that as "really" :/ --James -- -- James Mills -- -- "Problems are solved by method" --

Re: parsing tab and newline delimited text

2010-08-03 Thread James Mills
On Wed, Aug 4, 2010 at 12:14 PM, elsa wrote: > I have a large file of text I need to parse. Individual 'entries' are > separated by newline characters, while fields within each entry are > separated by tab characters. Sounds to me like a job of the csv module. cheers James

Re: Difference between queues and pipes in multiprocessing

2010-08-04 Thread James Mills
ons. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: lpr via subprocess in 2.4

2010-08-04 Thread James Mills
On Wed, Aug 4, 2010 at 9:38 PM, loial wrote: > I have also been trying to get the return code and standard error. p = Popen("..., stderr=PIPE) Look up the docs for subprocess.Popen cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.

Re: python terminology on classes

2010-08-04 Thread Rhodri James
seemed time to be a little sharper in the hope that learning might emerge. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question on parsing python: "is not None"

2010-08-05 Thread Rhodri James
pam" a is b False a == b True Also, remember that "is not" is a single operator, *not* the concatenation of "is" and "not". Your last test is probably not checking what you think it is :-) 3 is (not None) False -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Perl -> Python unpack

2010-08-06 Thread James Mills
Hey all, Quick question for you Python enthusiasts that also happen to know Perl quite well... What does a* or A* translate to in Python when unpacking binary data with struct.unpack(...) ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.o

Re: python interview quuestions

2010-08-06 Thread James Mills
w in some py3l questions > too) A common thing you can do in interviews is ask your interviewee to write (in Python) a solution to the "FizzBuzz" problem. Any good competent Python programmer should be able to do this in 5-10mins (5 if you're good). cheers james -- -- James

Re: python interview quuestions

2010-08-06 Thread James Mills
tually a very good point! Someone should post this very problem to this newsgroups/list and see how many active python programmers here actually "get it right" :) *evil grin* --james -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: python interview quuestions

2010-08-06 Thread James Mills
e done in just a single line of Python. 7 if you're not very familiar with Python. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl -> Python unpack

2010-08-06 Thread James Mills
On Sat, Aug 7, 2010 at 4:30 AM, James Mills wrote: > What does a* or A* translate to in Python when unpacking > binary data with struct.unpack(...) ? Fine I"ll answer my own question. Python _does not_ support implicit size in struct formatting rules. sizes are explicit meaning th

GSM to ISO / UCS2 to ISO

2010-08-16 Thread James Mills
.java Thanks, cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-16 Thread James Mills
to do?  -andrei My personal opinion (despite monitors being wider) is the horizontal scrolling isn't worth it. Stick to a 80-char width. cheers james -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-16 Thread James Mills
On Tue, Aug 17, 2010 at 12:50 PM, Roy Smith wrote: > I disagree with James.  I have no problem with going wider than 80, if > it improves readability by not forcing you to fold lines in unnatural > places. > > There's more important things to worry about. Roy, under normal c

Re: 79 chars or more?

2010-08-16 Thread James Mills
use the same standards (stick to project standards as Steven says). The other side is this... I'm of the opinion that if you're writing a line of code that's excessively long (>80char or say >100chars), then you might want to reconsider what you're doing :) (It might be wr

Re: 79 chars or more?

2010-08-16 Thread James Mills
;okay" to teach. However: Bare in mind other considerations for smaller width conventions and the reasons for them. Make your students aware of standards and get them into the habit of following standards early on. cheers James -- -- James Mills -- -- "Problems are solved by method" -

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread James Kanze
hunks using a stack. The length isn't the issue. The order of allocation and freeing is. (For many specific uses, stack based allocators can and have been used, but they don't work for generally allocation.) -- James Kanze -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a class method?

2010-08-22 Thread James Mills
k us questions :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a class method?

2010-08-22 Thread James Mills
thods myself personally in any of my work (yet). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract value and average

2009-06-08 Thread Rhodri James
values.append(float(words[i+2])) mean = sum(values)/len(values) should do the job. You don't need the second strip(), words = line.split() should be sufficient. (And we're back to the 'naked' bit again...) -- Rhodri James *-* Wildebeeste Herder to the Mass

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Rhodri James
know what you're doing but I'm seeing all of your posts twice, from two different addresses. This is a little confusing, to put it mildly, and doesn't half break the threading. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: install older Python version parallel

2009-06-11 Thread Rhodri James
than just "it crashes". What's the traceback? -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help in Python regular expression

2009-06-12 Thread Rhodri James
able {TABLE} and RenderTable {TABLE} [text with a-zA-Z=SPACE0-9] will match I try adding ".*" at the end , but it ends up just matching the second one. Curious, it should work (and match rather more than you want, but that's another matter. Try adding this instead: '

Re: TypeError: int argument required

2009-06-12 Thread Rhodri James
creating something so unreadable: use them. 3. matchobject.group(n) returns a string, not an int or float. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Good books in computer science?

2009-06-13 Thread Rhodri James
books for a software engineer. In that case The Mythical Man-Month (Brooks) is a must. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Lexical scope: converting Perl to Python

2009-06-13 Thread Rhodri James
en several possibilities, the "correct" answer might well be "don't do that at all" :-) -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about None

2009-06-13 Thread Rhodri James
g. Such an understanding would be clearly wrong in the context in which we were talking (and denotational semantics is a branch of category theory, which is not specific to computer science if you don't mind). If None is nothing, then it can't be a string, int, float or anything else,

Re: frustrating failure of 'break' statement ( novice )

2009-06-13 Thread Rhodri James
uot;invalid syntax" (pointing to the end of *print*) if I cut and paste the program exactly into a Python shell, presumably because the shell gets unhappy about having more command input when it wants to be executing the while loop. Does this match what you see? -- Rhodri Jame

Re: Different types of dicts with letter before the curly braces.

2009-06-14 Thread Rhodri James
sting literal syntax and expecting the result to be (a) obvious and (b) meaningful in the face of an ever-extending collection of basic types is optimistic in the extreme. Even Perl doesn't expect that much memory of you! -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Good books in computer science?

2009-06-14 Thread Rhodri James
you'll still be no good at good practice in practice. Practically speaking, that is :-) -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: int argument required

2009-06-14 Thread Rhodri James
On Sun, 14 Jun 2009 10:43:30 +0100, Lawrence D'Oliveiro wrote: In message , Rhodri James wrote: 2. That output string has severe "leaning toothpick" syndrome. Python accepts both single and double quotes to help avoid creating something so unreadable: use them. Backs

Re: TypeError: int argument required

2009-06-15 Thread Rhodri James
On Mon, 15 Jun 2009 01:33:50 +0100, Lawrence D'Oliveiro wrote: In message , Rhodri James wrote: On Sun, 14 Jun 2009 10:43:30 +0100, Lawrence D'Oliveiro wrote: In message , Rhodri James wrote: 2. That output string has severe "leaning toothpick" syndrome.

Re: persistent composites

2009-06-17 Thread Rhodri James
trate that it is a problem, whichever of the many possible 'it's you're talking about. So far, the question "Why would I want to use this? What's the use case?" has gone unanswered, and I'm sure I'm not the only baffled by it. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to overwrite a file

2009-06-17 Thread Rhodri James
doing that, especially for personal use. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: int argument required

2009-06-17 Thread Rhodri James
t give you much more help. Yes, I know from past conversations that you have a superhuman ability to recognise the code in apparent line noise. That still doesn't make it legible to anyone else. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

GUI(eclipse+pydev/SPE) freeze when doing python auto-completion under Linux

2009-06-17 Thread Wei, James
When I am editing python program with SPE, I found that SPE will freeze when it is doing auto-completion. The behavior is very strange that I can not edit the file again. If I switch to another file and then switch back, I can edit it again. So I switch to eclipse+pydev, but I found the same thing

Re: GUI(eclipse+pydev/SPE) freeze when doing python auto-completion under Linux

2009-06-17 Thread Wei, James
On Jun 18, 10:45 am, "Wei, James" wrote: > When I am editing python program with SPE, I found that SPE will > freeze when it is doing auto-completion. The behavior is very strange > that I can not edit the file again. If I switch to another file and > then switch back, I can

Re: TypeError: int argument required

2009-06-18 Thread Rhodri James
t I was complaining about. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: ERROR: how to use a text file in a module?

2009-06-18 Thread Rhodri James
ome directory or the filesystem root and change the filename to match it (as in 'open("/usr/local/lalala/topo.txt", "r")' or 'open("~/Network/Test/topo.txt", "r")', or the equivalent on Windows). -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this pylint error message valid or silly?

2009-06-19 Thread Rhodri James
27;s a very common idiom, however, and in addition record_data is None is a cheap test, while record_data == "defaults to today's date" is an expensive test as well as easy to mistype. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent composites

2009-06-19 Thread Rhodri James
On Fri, 19 Jun 2009 14:24:34 +0100, Aaron Brady wrote: You are not being any help, Rhodri, in your question. To you, perhaps not. To me, it has at least had the effect of making what you're trying to do (write a pythonic object database) clearer. -- Rhodri James *-* Wildebeest Herd

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Rhodri James
test is None: test = A() self.obj = A() and so on. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent composites

2009-06-20 Thread Rhodri James
Whether or not you are brilliant, that doesn't go down well. When you're trying to generate interest in something, actively generating disinterest like that isn't going to help. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: re.NONE

2009-06-22 Thread Rhodri James
e like. There's no issue with defining that to be 0, since it is the correct value! -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: [RELEASED] Python 3.1 final

2009-06-28 Thread Rhodri James
then? Bleh. It's still the wrong solution, and it still makes the right solution harder to do. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: pep 8 constants

2009-06-28 Thread Rhodri James
that PEP 8 is more work for an SR system than any other convention. If, on the other hand you're trying to convince me that *no* convention is preferable, I'm going to laugh hollowly. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: [RELEASED] Python 3.1 final

2009-06-28 Thread Rhodri James
artin! -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: pep 8 constants

2009-06-29 Thread Rhodri James
On Mon, 29 Jun 2009 06:07:19 +0100, Eric S. Johansson wrote: Rhodri James wrote: Reject away, but I'm afraid you've still got some work to do to convince me that PEP 8 is more work for an SR system than any other convention. [snip sundry examples] Yes, yes, recognition sy

Re: pep 8 constants

2009-06-29 Thread Rhodri James
On Mon, 29 Jun 2009 20:28:07 +0100, Eric S. Johansson wrote: Rhodri James wrote: As far as I can tell, the only thing that you are even vaguely suggesting for convention use is underscores_with_everything. As promised, I laugh hollowly. I'm sorry. It may have been too subtle

Re: pep 8 constants

2009-06-30 Thread Rhodri James
really possible for an editor to be smart enough -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: pep 8 constants

2009-06-30 Thread Rhodri James
On Tue, 30 Jun 2009 09:57:27 +0100, Rhodri James wrote: On Tue, 30 Jun 2009 03:37:15 +0100, Eric S. Johansson wrote: Steven D'Aprano wrote: Why do you think a smart editing environment is in opposition to coding conventions? Surely an editor smart enough to know a variable

Re: Specific iterator in one line

2009-06-30 Thread Rhodri James
it possible to achieve this? Curiosly, the other way round is pretty simple to achieve, because you can filter objects using if in list comprehension. If you'll allow me a prior "import itertools", [i for e in [1,0,0,1] for i in itertools.repeat('ab'[e], e+1)] does the job in 62 characters. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: pep 8 constants

2009-06-30 Thread Rhodri James
to disambiguate visually at a glance, I don't see that it's avoidable. Incidentally, since what you're proposing is essentially templating, wouldn't it be better to do it as post-processing on the speech recognition rather than building it directly into an editor? to resolve -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Python/Pygame question

2009-07-01 Thread Rhodri James
your file into a surface, then blit it into your display. Some resizing may be necessary! -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: String to List Question

2009-07-02 Thread Rhodri James
library/csv.html You can define yourself a reader that splits the input on tabs, and then see how long the rows it returns are. Something like this (untested): import csv for row in csv.reader(open("phone_numbers.txt", "rb"), delimiter='\t'): if len(row) >

Re: pep 8 constants

2009-07-05 Thread Rhodri James
aggravate a hand injury which may not be possible. Anyway, just thinking out loud. You can get giant piano keyboards that you step on, so how about a giant computer keyboard? "I wrote 5 miles of code before lunch!" :-) You can get/make MIDI organ pedal-boards (a friend of mine has

Re: PEP368 and pixeliterators

2009-07-05 Thread Rhodri James
that's just fine, but the assumption that an image is made up of a 2D array of pixels is not safe. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: A Bug By Any Other Name ...

2009-07-06 Thread Rhodri James
isn't that common a surprise even for Java and C programmers. This is the first time I've seen anyone raise it as an issue. Indeed, arguably it's a bug for C compilers to fail to find the valid parsing of "++5" as "+(+5)". All I can say is that I've neve

Re: Python and webcam capture delay?

2009-07-06 Thread Rhodri James
t on what format the webcam claims to deliver. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and webcam capture delay?

2009-07-06 Thread Rhodri James
On Mon, 06 Jul 2009 18:41:03 +0100, jack catcher (nick) wrote: Rhodri James kirjoitti: Does the webcam just deliver frames, or are you getting frames out of a decoder layer? If it's the latter, you want to distribute the encoded video, which should be much lower bandwidth. Exactl

Re: Why re.match()?

2009-07-06 Thread Rhodri James
the (small) increase in size. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie needs help

2009-07-06 Thread Rhodri James
ython environment? Which Python version for that matter? We may appear to be mind-readers, but we usually need a bit more than this to work on. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: A Bug By Any Other Name ...

2009-07-06 Thread Rhodri James
On Mon, 06 Jul 2009 17:54:35 +0100, Dave Angel wrote: Rhodri James wrote: Indeed, arguably it's a bug for C compilers to fail to find the valid parsing of "++5" as "+(+5)". All I can say is that I've never even accidentally typed that in twenty years of C pr

Re: Semi-Newbie needs a little help

2009-07-06 Thread Rhodri James
Have you checked the indentation of the print statement that produces this? Is it perhaps inside a loop still? -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a slick way to classify relationship between two numbers, without tons of if/else

2009-07-06 Thread Rhodri James
t None or b is not None: return "No data" c = cmp(a, b) + 1 if c == 2 and b == 0: c = 3 return CMP_TABLE[c] There's no cmp() in Python 3.x so you'd have to roll your own. At that point you might as well revert to the if-chain, since it'll be a lot easier to understand when you come back to it in six months time. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: regex help

2009-07-08 Thread Rhodri James
and P/E values - but apart from doing loads of indivdual REs which I think would look messy, I can't think of a better and neater looking way. Any ideas? What you're trying to do is inherently messy. You might want to use something like BeautifulSoup to hide the mess, but never

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Rhodri James
at all the built-in functions are. Over time a programmer will learn which names to avoid, but it's a bit of a pitfall early on. It's only really a pitfall if you try to use the built-in after you've redefined it. That's the thing to keep an eye open for. -- Rhodri James *-* W

Re: help me to find the error

2009-07-10 Thread Rhodri James
and so on Notice that I only opened the file as "r" -- you are only reading it, not updating it, and giving yourself more permission than you need is a bad habit to get into. Opening the file this way means that if you accidentally write f0.write("something") instead of "f2.write(something)", Python will stop you with an exception rather than silently trash your data. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: need to write a assembly progrm

2009-07-10 Thread Rhodri James
lab.tell me any other solutions for this Please define what you mean by "assembly". -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: need to write a assembly progrm

2009-07-12 Thread Rhodri James
On Sat, 11 Jul 2009 05:17:18 +0100, Dennis Lee Bieber wrote: On Fri, 10 Jul 2009 13:25:49 +0100, "Rhodri James" declaimed the following in gmane.comp.python.general: On Thu, 09 Jul 2009 11:52:44 +0100, m.reddy prasad reddy wrote: > my aim is to run the assembly programs

Re: select lines in python

2009-07-14 Thread Rhodri James
ine The readlines() is unnecessary, and if your file is at all long you'd be better off precompiling the regular expression. import re expr = re.compile("PHE|ASP") with open("filename") as f: for line in f: if expr.search(line): print line -

Re: select lines in python

2009-07-15 Thread Rhodri James
than tell you exactly how. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Override a method but inherit the docstring

2009-07-16 Thread Rhodri James
__name__].__doc__ return fn return _fn class BarGonk(FooGonk): @copydoc(FooGonk) def frobnicate(self): special_implementation(self.warble) -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginners question

2009-07-18 Thread Rhodri James
nderlying class attribute is *not* changed. class ClassName: global_var = 1 def some_method(self): self.global_var = 2 a = ClassName() b = ClassName() b.some_method() print a.global_var, b.global_var ...gives the result "1 2" again! -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread James Matthews
I like this, I am going to run this as a test. I also want to see the source code on how they compile the dynamic variables. On Mon, Jul 20, 2009 at 10:20 PM, srepmub wrote: > > > Nice timings, can you please show me the Python, Java and C code > > versions? I may do more tests. > > also, which

Re: Regular expression

2009-07-21 Thread Rhodri James
what "it handles file correctly" means, since the regular expresion makes little sense with the input you give. What are you trying to extract from the input, and what do you think you are getting at the moment? -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression

2009-07-21 Thread Rhodri James
On Tue, 21 Jul 2009 17:12:53 +0100, Peter Fodrek wrote: 21.7.2009 v 17:39, Rhodri James: On Tue, 21 Jul 2009 14:30:47 +0100, Peter Fodrek > wrote: [snipped for space] This handles text file like // remark PL_OFF PARK FS MA 52.8806 , 18.0914 SS AD_W PL_ON C 52.3955 , -16.1

Re: Changing the private variables content

2009-07-21 Thread Rhodri James
do outside its class, but nothing will stop you doing exactly that if you're rude enough to try. Does that help? -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Detect target name in descriptor __set__ method

2009-07-22 Thread Rhodri James
On Wed, 22 Jul 2009 06:02:55 +0100, Gabriel Genellina wrote: class X(object): foo = descriptor() x = X() x.foo = "value" Isn't this going to create a brand new instance attribute x.foo that has nothing to do with the descriptor anyway? -- Rhodri James *-* Wildebees

Re: Not understanding this documentation

2009-07-22 Thread Rhodri James
the rest of the error message, please? I have a suspicion that the error actually lies in the "necessary changes" you made. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

<    27   28   29   30   31   32   33   34   35   36   >