Re: Yet another attempt at a safe eval() call

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 4:14 AM, Grant Edwards wrote: > On 2013-01-04, Chris Angelico wrote: >> On Sat, Jan 5, 2013 at 3:38 AM, Grant Edwards >> wrote: > >>> I've added equals, backslash, commas, square/curly brackets, colons >>> and semicolons to the

Re: Yet another attempt at a safe eval() call

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 5:09 AM, Grant Edwards wrote: > The error messages are still pretty cryptic, so improving > that will add a few more lines. One nice thing about the ast code is > that it's simple to add code to allow C-like character constants such > that ('A' === 0x41). Here's the first

Re: problem with exam task for college

2013-01-04 Thread Chris Angelico
ould simply have a class ruimteschip that knows how to draw itself. Final comment: Your code is fairly well laid out, and your query is clear. Thanks! It's so much easier to read than something that's vague about what's actually wrong :) Just one thing. Your subject line doesn't

Re: Yet another attempt at a safe eval() call

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 5:43 AM, Grant Edwards wrote: > On 2013-01-04, Chris Angelico wrote: >> On Sat, Jan 5, 2013 at 5:09 AM, Grant Edwards >> wrote: >>> The error messages are still pretty cryptic, so improving >>> that will add a few more lines. One

Re: problem with exam task for college

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 5:59 AM, Chris Angelico wrote: > Google tells me that brandstofmeter might mean "Babylon 9" And by the way, in case it didn't come across, I'm jesting there. What I mean is that Google didn't have any useful and obvious results indicating what

Re: problem with exam task for college

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 6:18 AM, Joshua Landau wrote: > It might measure a brand in femtometers ;). LOL! > But, seriously, it's Dutch for Fuel Gauge. Google told me, in case you think > I know Dutch, but it's in the Python Spirit either way. > > ruimteschip -> Spaceship > hoek -> angle > sterren

Re: problem with exam task for college

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 7:01 AM, wrote: > woow jeezes, thanks for the amazingly fast and detailed response, you guys > are amazing. > > thanks again, are you guys getting paid for this or is this voluntarily? > either way i really appreciate it We're all volunteers (and it's now 7:30AM Saturday

Re: Need a specific sort of string modification. Can someone help?

2013-01-05 Thread Chris Angelico
On Sat, Jan 5, 2013 at 7:35 PM, Sia wrote: > I have strings such as: > > tA.-2AG.-2AG,-2ag > or > .+3ACG.+5CAACG.+3ACG.+3ACG > > The plus and minus signs are always followed by a number (say, i). I want > python to find each single plus or minus, remove the sign, the number after > it and remove

Re: pygame - importing GL - very bad...

2013-01-05 Thread Chris Angelico
On Sat, Jan 5, 2013 at 9:49 PM, someone wrote: > Ok, I think you're right. At least I find that C-compilers catches many > errors/warnings which python don't say anything about. But also C require me > to define/declarer the types of variables before I use them... OTOH I guess > I like that python

Re: problem with exam task for college

2013-01-05 Thread Chris Angelico
On Sat, Jan 5, 2013 at 11:24 PM, wrote: > hy again,thanx, i updated my code with your more efficient approach :), so > that possibly resolves problem number 2, but still leaves me with problem > n°1, my code is still stuck in the first update of the fuel tank > (brandstoftank), for the sake of

Re: pygame - importing GL - very bad...

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 12:06 AM, someone wrote: > On 01/05/2013 12:47 PM, Chris Angelico wrote: >> You can find good references on the subject in various >> places, but call-by-reference as implemented in Pascal simply doesn't >> exist in most modern languages, bec

Re: problem with exam task for college

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 12:14 AM, wrote: > that's probably it, how do i solve it? I'm afraid I can't help you there. Check out the docs for the getkey function and see if it can be put into non-blocking mode; if not, you may have to completely change your model. For instance, if I were writing th

Re: Couting the number of lines of code of a python program

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 12:55 AM, chaouche yacine wrote: > The > problem is that I'm using the inspect module, because it provides a > nice function inspect.getsourcelines that takes a python object and > return its number of lines of code. BUT, it works on live objects, that > means one has to fi

Re: Need a specific sort of string modification. Can someone help?

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 1:30 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> result = "".join([x[int(x[0])+1:] for x in >> ("0"+s).replace("-","+").split("+")]) > > That's exceedingly clever. Bu

Re: Need a specific sort of string modification. Can someone help?

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 2:03 AM, Roy Smith wrote: > That's why I chose to split this where I did. It was where the scan > direction changed. Ah, good point. In any case, this is a fairly simple and clear way of doing things; it may or may not run faster than the explicit state machine, but IMHO i

Re: Couting the number of lines of code of a python program

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 2:17 AM, chaouche yacine wrote: > defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line > =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring > andnot(line.startswith('"""')orline.startswith("'''"))\ > or(line.startswith("'''")andline.endswith("'''

Re: Need a specific sort of string modification. Can someone help?

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 2:38 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> it may or may not run faster than the explicit state machine, > > You got me by a factor of 3 or 4. Not bad. You miss my point, though. I went for simple Pythonic code, a

Re: Yet another attempt at a safe eval() call

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 2:56 AM, Oscar Benjamin wrote: > On 4 January 2013 15:53, Grant Edwards wrote: >> On 2013-01-04, Steven D'Aprano wrote: >>> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrote: >>> >>> * But frankly, you should avoid eval, and write your own mini-integer >>> arithmet

Re: Random List Loop?!

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 2:47 AM, Christian Gabriel wrote: > Hi > > I have tried now for ages to make a loop that does the following: > > Makes a new list with 9 random values, from 9 different lists, with 9 > elements. > > And makes sure that none of the elements repeat! > > Is there anyone that c

Re: Need a specific sort of string modification. Can someone help?

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 7:04 AM, Ian Kelly wrote: > On Sat, Jan 5, 2013 at 8:57 AM, Chris Angelico wrote: >> You miss my point, though. I went for simple Pythonic code, and never >> measured its performance, on the expectation that it's "good enough". >>

Re: Python programming philosophy

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 9:05 AM, Nac Temha wrote: > Hello, > > I want to learn working principle of python as broadly. How to interpret the > python? For example, what is pyc files and when does it occur? > Can you explain them? Thanks in advance. The pyc files aren't really a philosophical point

Re: os.path.realpath(path) bug on win7 ?

2013-01-05 Thread Chris Rebert
> 'C:\\Users\\SAMSUNG\\Temp.link\\test2' > > I thought the return value should be ' C:\\test\\test1\\test2' > > Is it a bug ? anyone can clear it to me ? What does os.path.islink('C:/Users/SAMSUNG/Temp.link') report? Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: How to modify this script?

2013-01-06 Thread Chris Angelico
On Sun, Jan 6, 2013 at 11:42 PM, Kurt Hansen wrote: > Since there's only one "field" in the first line, I want this output: > > Price table > > - insted of > > Price table > > How to? Thank you i advance. It's actually quite simple, as long as you don't mind the junk of colspan="1" on all the oth

Re: Proof that nobody reads the tests

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 12:01 AM, chaouche yacine wrote: > Has anybody read the source code of > /usr/lib/python2.7/test/inspect_fodder.py ? > > I wonder how did they let this into the official python distribution. I > thought Guido was serious :) people of the PSF seem to have a certain sense > of

Re: Proof that nobody reads the tests

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 12:26 AM, chaouche yacine wrote: > Oh :) sorry I didn't know they were references to monty python sketches. > That explains it then :) Check out the Argument Clinic some time :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: How to modify this script?

2013-01-06 Thread Chris Angelico
to be changed. Python loops (and other control structures) are defined by indentation, so the innermost loop is the one that starts furthest to the right. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to modify this script?

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 1:03 AM, Kurt Hansen wrote: > I'm sorry to bother you, Chris, but applying the snippet with your code in > Gedit still just deletes the marked, tab-separated text in the editor. Ah, whoops. That would be because I had a bug in the code (that's why I comme

Re: How to modify this script?

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 1:30 AM, Kurt Hansen wrote: > Den 06/01/13 15.20, Chris Angelico wrote: > >> On Mon, Jan 7, 2013 at 1:03 AM, Kurt Hansen wrote: >>> >>> I'm sorry to bother you, Chris, but applying the snippet with your code >>> in >>&g

Re: How to modify this script?

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 1:40 AM, Kurt Hansen wrote: > failed: cannot concatenate 'str' and 'tuple' objects The problem is this line: output += '', line, '' Change it to: output += '' + line + '' ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 8:38 AM, wrote: > But something is preventing this from working, and I don't know enough to > figure it out, despite having spent most of today reading up. The code > executes with no error, yet no table is created or populated. Standard databasing requirement: You need

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 9:14 AM, Mitya Sirenef wrote: > On Sun 06 Jan 2013 04:53:32 PM EST, [email protected] wrote: >> >> Wow it's as simple as that! I'm afraid my database experience is in >> Microsoft Access in Windows and not at the command line, so that wasn't >> intuitive for me. >> > IIR

Re: Over 30 types of variables available in python ?

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 10:12 AM, chaouche yacine wrote: > > booleans > ints, floats, longs, complexes > strings, unicode strings > lists, tuples, dictionaries, dictionary views, sets, frozensets, buffers, > bytearrays, slices > functions, methods, code objects,modules,classes, instances, types, nu

Re: License status of pycollada?

2013-01-07 Thread Chris Rebert
repo seems freely browseable. Looks like it's under a standard 3-clause BSD-style license: https://github.com/pycollada/pycollada/blob/master/COPYING -- Cheers, Chris -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with Unicode char in Python 3.3.0

2013-01-07 Thread Chris Angelico
On Mon, Jan 7, 2013 at 11:57 PM, Franck Ditter wrote: > <<< print('\U0001d11e') > Traceback (most recent call last): > File "", line 1, in > print('\U0001d11e') > UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001d11e' > in position 0: Non-BMP character not supported in Tk Th

Re: Over 30 types of variables available in python ?

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 1:45 AM, Dave Angel wrote: > On 01/07/2013 09:32 AM, marduk wrote: >> So I guess if one *really* wanted to compare C variables to Python >> variables, you could say that all python variables are of type void* >> except Python does all mallocs/frees and the casting for you. >

Re: what’s the difference between socket.send() and socket.sendall() ?

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 2:28 AM, Steven D'Aprano wrote: > I > once was on a maths mailing list for about three years before I > realised that the most prolific and helpful person there was as > blind as a bat. And that, I think, is what s/he would have most wanted: three years (more, most li

Re: Vigil, the eternal morally vigilant programming language

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 3:01 AM, Alain Ketterlin wrote: > > I just came across Vigil, an extension to python for serious software > engineers, at https://github.com/munificent/vigil and thought everybody > in this group would be interested (sorry if it has been announced > before). It's the logica

Re: help

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 10:35 AM, wrote: > download wxpython but whenever I try to use it I get this I’m a beginner in > python pls I need help. > > ImportError: DLL load failed: %1 is not a valid Win32 application. Did you download the 64-bit version on a 32-bit system? Chris Angel

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 4:58 AM, Steven D'Aprano wrote: > Anyone can fool themselves into placing a line through a subset of non- > linear data. Or, sadly more often, *deliberately* cherry picking fake > clusters in order to fool others. Here is a real world example of what > happens when people pi

Re: Difference between these two lists?

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 12:00 PM, wrote: > Hi, > > Python newbie here again - this is probably a quick one. What's the > difference between the lines I've numbered 1. and 2. below, which produce the > following results: >1. print stn_fields = '[%s]' % ', '.join(map(str, stn_list_short)) >

Re: Difference between these two lists?

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 12:06 PM, wrote: > I think I can answer my own question on reflection the first one is > actually a string I think? I was confused by the square brackets around the > placeholder %s. That's correct. Your first line is putting square brackets around a comma-joined li

Re: Difference between these two lists?

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 1:21 PM, wrote: > Repr and Eval I think I get. Eval certainly. That's a familiar concept, and > one I hope to use tomorrow to feed a line to psycopg2. I hope not. Why do you need eval? It's extremely dangerous. Chances are there's a better way to do it; if your users are

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-07 Thread Chris Angelico
On Tue, Jan 8, 2013 at 1:06 PM, Steven D'Aprano wrote: >> given that weather patterns have been known to follow cycles at least >> that long. > > That is not a given. "Weather patterns" don't last for thirty years. > Perhaps you are talking about climate patterns? Yes, that's what I meant. In any

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Chris Angelico
On Wed, Jan 9, 2013 at 2:55 AM, Robert Kern wrote: > On 08/01/2013 06:35, Chris Angelico wrote: >> ... it looks >> quite significant to show a line going from the bottom of the graph to >> the top, but sounds a lot less noteworthy when you see it as a >> half-degree

Re: Best way to do this? List loop (matrix?) iteration

2013-01-08 Thread Chris Angelico
On Wed, Jan 9, 2013 at 11:19 AM, wrote: >stn_count = len(stn_list_short) >for rowcount in range (0, stn_count): > for colcount in range (0, stn_count): > print stn_list_long[rowcount] stn_list_long[colcount] First off, you can iterate over the list directly: for row in st

Re: new to python and programming at large

2013-01-09 Thread Chris Angelico
vention used in classes. You probably want to call your argument y: def squareroot(y): since that's what you then pass to math.sqrt. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: new to python and programming at large

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 2:38 AM, Alister wrote: > On Thu, 10 Jan 2013 02:18:11 +1100, Chris Angelico wrote: > >> On Thu, Jan 10, 2013 at 8:03 AM, wrote: >>> pls I want to write a function that can compute for the sqrt root of >>> any number.bt it not working pls h

Re: ANN: PyDTLS

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 7:04 AM, rbit wrote: > The following are some of the main use cases that force applications into > datagram protocols: > > * Minimizing protocol overhead. TCP has relatively high overhead, > for example, its 3-way handshake for connection establishment. > On

Re: Why BOM in logging message?

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 9:54 AM, Roy Smith wrote: > What's weird is that two of the servers, and only those two, stick a > BOM (Byte Order Mark) in front of the message they log. Could it be this issue you're looking at? http://bugs.python.org/issue14452 What are the exact Python versions in us

Re: How to call wget by python ?

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 1:11 PM, iMath wrote: > can you give me an example code ? > -- > http://mail.python.org/mailman/listinfo/python-list You've asked several very vague questions. I would strongly recommend that you read this: http://www.catb.org/esr/faqs/smart-questions.html Invoking wget

Re: How to call wget by python ?

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 2:21 PM, 8 Dihedral wrote: > Inherantly the python interpreter has a GC builtin > to use pacakages like DLL by reference counting. That almost makes sense. And it's almost profound, too. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Why BOM in logging message?

2013-01-10 Thread Chris Angelico
On Fri, Jan 11, 2013 at 3:06 AM, Roy Smith wrote: > Well, this is fascinating. It turns out that while all of our > machines report that they're running 2.7.3, they have two different > versions of /usr/lib/python2.7/logging/handlers.py! > > -rw-r--r-- 1 root root 45076 Aug 1 05:39 > /usr/lib/p

Re: Why BOM in logging message?

2013-01-10 Thread Chris Angelico
On Fri, Jan 11, 2013 at 3:40 AM, Roy Smith wrote: >>On Fri, Jan 11, 2013 at 3:06 AM, Roy Smith wrote: >>> -rw-r--r-- 1 root root 45076 Aug 1 05:39 >>> /usr/lib/python2.7/logging/handlers.py >>> -rw-r--r-- 1 root root 45143 Apr 20 2012 >>> /usr/l

Re: PyWart: Import resolution order

2013-01-10 Thread Chris Angelico
On Fri, Jan 11, 2013 at 5:13 PM, Rick Johnson wrote: > The fact that Python looks in the stdlib _first_ is not a good idea. It would > seem more intuitive for a custom "math" module (living in the current > directory) to /override/ the stlib "math" module. The proper order is as > follows: > >

Re: Problem with importing in Python

2013-01-11 Thread Chris Angelico
On Sat, Jan 12, 2013 at 9:17 AM, su29090 <[email protected]> wrote: > Circle.py > > class circle: > > from Circle import Circle Inside the Circle module is a class named circle. You can't import Circle from that. But Python isn't Java. You don't have to put each class into its own file. Just put

Re: PyWart: Module access syntax

2013-01-11 Thread Chris Angelico
On Sat, Jan 12, 2013 at 3:34 PM, Rick Johnson wrote: > *The problem:* > ... is readability. The current dot syntax used ubiquitously in paths is not > conveying the proper information to the reader, and in-fact obfuscating the > code. Please explain how this is a problem. As Steven said, there

Re: async fuction

2013-01-11 Thread Chris Angelico
On Sat, Jan 12, 2013 at 3:43 PM, wrote: > def fnc1(pp): > print "fnc1-",pp > > fnc1() Like the message says, the function has been defined to take one argument, and you're giving it none. Try giving it an argument: fnc1("five-minute") ChrisA -- http://mail.python.org/mailman/listinfo/pyth

Re: Problem with importing in Python

2013-01-11 Thread Chris Angelico
On Sat, Jan 12, 2013 at 3:37 PM, Tim Roberts wrote: > Dave Angel wrote: >> >>As Adnan has pointed out, Python is case insensitive. > > That's not really what you meant to say... UNinsensitive, your Majesty means, of course. UNinsensitive, of course, I meant. *watches the jurors write it down, s

Re: PyWart: Module access syntax

2013-01-11 Thread Chris Angelico
On Sat, Jan 12, 2013 at 4:46 PM, Rick Johnson wrote: > This is a matter of READABILITY, Christopher. It's one or the other (or the > status quo): > > 1. Enforce naming conventions. > 2. Enforce path syntax. > 3. Continue to duck type, like Python is good at. > > The choice is yours. FTFY. Chris

Re: PyWart: Import resolution order

2013-01-11 Thread Chris Angelico
On Sat, Jan 12, 2013 at 4:28 PM, Rick Johnson wrote: > On Friday, January 11, 2013 12:30:27 AM UTC-6, Chris Angelico wrote: >> Welcome back to the list, Rick. Got any demonstrable code >> for Python 4000 yet? > > I am working on it. Stay tuned. Rick is going to rock yo

stringbench (was Re: String concatenation benchmarking weirdness)

2013-01-12 Thread Chris Angelico
On Sat, Jan 12, 2013 at 10:31 PM, Terry Reedy wrote: > 0.410.4395.2("WHERE IN THE WORLD IS CARMEN SAN > DEIGO?"*10).lower() Why does stringbench misspell the name Carmen Sandiego? Copyright avoidance? ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: stringbench (was Re: String concatenation benchmarking weirdness)

2013-01-12 Thread Chris Angelico
On Sun, Jan 13, 2013 at 1:27 AM, Terry Reedy wrote: > On 1/12/2013 6:42 AM, Chris Angelico wrote: >> >> On Sat, Jan 12, 2013 at 10:31 PM, Terry Reedy wrote: >>> >>> 0.410.4395.2("WHERE IN THE WORLD IS CARMEN SAN >>> DEIGO?"*10).low

Re: average time calculation??

2013-01-12 Thread Chris Angelico
On Sun, Jan 13, 2013 at 2:32 AM, Thomas Boell wrote: > This is how I would probably go about it: > Convert your strings to floating point values which describe the time > in seconds. Either floats or integers (which would be milliseconds, or whatever your smallest unit is). I tend to prefer in

Re: please solve my problem

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 7:35 AM, Divya Thakur wrote: > raise TemplateDoesNotExist(name) > TemplateDoesNotExist: 500.html > [14/Jan/2013 01:08:11] "GET /static/images/products/thumbnails/12345 > HTTP/1.1" 500 59 This sounds like a Django-specific issue. You'll probably get better results from

Re: pylint or similar to test version-specific language constructs?

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 4:56 AM, jkn wrote: > Hi Dave > > On 11 Jan, 15:06, Dave Angel wrote: >> >> Not sure what you mean by beforehand. Don't you run all your unit tests >> before putting each revision of your code into production? So run those >> tests twice, once on 2.7, and once on 2.4. A

Re: PyWart (Terminolgy): "Class"

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 5:46 PM, Rick Johnson wrote: > Dear language designers: Stop propagating such foolish terminology! End the > infection of "class" in all source code, docs, and daily conversation. Be > more consistent and logical. Resist temptation to use poor terminology simply > becaus

Re: PyWart (Terminolgy): "Class"

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 6:32 PM, Rick Johnson wrote: > I really don't like using two words ("define object", or "def obj") and using > one single keyword is ambiguous ("object" or "obj"). So the obvious solution > is to combine the abbreviated words into one compound keyword that will save > ke

Re: Thought of the day

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 1:15 AM, Tim Chase wrote: > A newbie programmer had a problem and thought > > > > "I'll solve it by posting on > > > > [email protected] and on Google Groups". > > > > And now we have the problem of two threads... And, when faced with problems of having two threads, t

Re: Python modules

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 1:54 AM, zoom wrote: > Is there any "rules" regarding importing python modules within your own > module? I mean, how does this affects the performance of the program? > > In short, when creating a module, is it worthwhile to be careful and import > only necessary functions,

Re: proposal: Ellipsis in argument list

2013-01-14 Thread Chris Kaynor
On Sat, Jan 12, 2013 at 5:30 AM, Szabolcs Blága wrote: > Dear All, > > I have an idea that the Ellipsis object could be used in function calls. > The "..." syntax should automagically turn into an Ellipsis positional > argument. > > def f(*args): > ext_args = [] > for i, a in enumerate(args):

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 6:43 AM, Peter wrote: > Real mature lot of responses here guys - shows how much you have grown up. > > Reading this thread looked more like observing a bunch of 3rd grader - > somebody offers an opinion and all you can do is ridicule it? > > Real mature - certainly gives P

Re: Finding the variables (read or write)

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 6:48 AM, wrote: > I'd like to develop a small debugging tool for python programs.In Dynamic > Slicing How can I find the variables that are accessed in a statement? And > find the type of access (read or write) for those variables (in Python). > ### Write: A statement ca

Re: Finding the variables (read or write)

2013-01-14 Thread Chris Kaynor
On Mon, Jan 14, 2013 at 1:28 PM, Chris Angelico wrote: > On Tue, Jan 15, 2013 at 6:48 AM, wrote: > > I'd like to develop a small debugging tool for python programs.In > Dynamic Slicing How can I find the variables that are accessed in a > statement? And find the type of a

Re: Finding the variables (read or write)

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 8:37 AM, Chris Kaynor wrote: > And those aren't even covering the case that a, normally non-mutating, > method actually mutates. If it's static analysis, I'd quietly ignore those sorts of cases. Anything can be changed any time, including stuff that&#

Re: PyWart: Module access syntax

2013-01-15 Thread Chris Angelico
On Tue, Jan 15, 2013 at 6:49 PM, Rick Johnson wrote: > Look, maybe nobody has the time to deal with this module, so if you need some > help, then feel free to ask for my assistance. All Guido has to do is send me > a private email and say: > > """ Hello Rick! Your ideas for packaging of Tkinter

Re: Thought of the day

2013-01-15 Thread Chris Angelico
On Wed, Jan 16, 2013 at 3:48 AM, Antoine Pitrou wrote: > D'Aprano: No, no. Look. This thread business -- it doesn't really matter. > The threads aren't important. A few friends call me Two Threads and that's > all there is to it. I wish you'd ask me about the logfile. Everybody talks > about the t

Re: cymbalic reference?

2013-01-15 Thread Chris Angelico
On Wed, Jan 16, 2013 at 3:56 PM, rh wrote: > While I'm at it what magic could I use to print "the-class-I-am-in good" > instead of hard-coding "Abc good"? I tried __class_ and self.__class__ Almost there! Try self.__class__.__name__ to get the name as a string. ChrisA -- http://mail.python.org/

Re: PyWart: Exception error paths far too verbose

2013-01-16 Thread Chris Angelico
On Wed, Jan 16, 2013 at 7:31 PM, donarb wrote: > Done > > https://github.com/erikrose/tracefront > > This module displays traces with shortened paths, and will even prepend your > editor of choice and line number to the path, making a shortcut to jumping to > the source in error via copy/paste.

Re: PyWart: Exception error paths far too verbose

2013-01-16 Thread Chris Angelico
On Thu, Jan 17, 2013 at 4:32 AM, Rick Johnson wrote: > On 1-16-2013 8:45 AM Steven D'Aprano wrote: >> What personal library folder? > > The single MONOLITHIC folder you SHOULD be using to contain all your personal > modules and scripts! But of course you are not doing this, only professionals >

Re: python sys.stdout and C++ iostreams::cout

2013-01-17 Thread Chris Angelico
On Fri, Jan 18, 2013 at 2:02 AM, Utpal Sarkar wrote: > I was assuming that sys.stdout would be referencing the same physical stream > as iostreams::cout running in the same process, but this doesn't seem to be > the case. That's more-or-less true, but there will likely be separate buffering, so

Re: python sys.stdout and C++ iostreams::cout

2013-01-17 Thread Chris Angelico
On Fri, Jan 18, 2013 at 2:51 AM, Utpal Sarkar wrote: > Thanks a lot Chris and Nobody! I'll have a look at dup2 for a start. Okay. Look for code that redirects the standard I/O streams and then exec()s another process (possibly after fork()ing); you're going to be doing pretty much t

Re: [HELP!] a doubt about entering password in python

2013-01-17 Thread Chris Angelico
On Fri, Jan 18, 2013 at 3:45 PM, Ramchandra Apte wrote: > I think you are correct - su uses some tty magic to stop ECHO and probably > doesn't read the password from stdin. I believe that's right, but the 'sudo' command - at least on my Debian and Ubuntu systems - accepts a -S parameter to read

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 5:58 AM, Ferrous Cranus wrote: > Τη Παρασκευή, 18 Ιανουαρίου 2013 3:28:10 μ.μ. UTC+2, ο χρήστης Joel Goldstick > έγραψε: > >> DocumentRoot = os.environ['HOME'] + 'public_html' > > Yes, iam using this and it works. > One last thing: > > my python script file is located at

Re: Vote tallying...

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 7:24 AM, Ben Finney wrote: > * MySQL's development has suffered under Sun, and become virtually > moribund under Oracle. They operate as a closed shop, occasionally > tossing GPL-licensed releases over the wall, with very little input > accepted from the community. I

Re: Vote tallying...

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 12:25 PM, Kushal Kumaran wrote: > Chris Angelico writes: > >> On Sat, Jan 19, 2013 at 7:24 AM, Ben Finney >> wrote: >>> * MySQL's development has suffered under Sun, and become virtually >>> moribund under Oracle. Th

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Chris Rebert
s a race condition there: it is possible that another thread may have added the same key between the check and the > store. > > How can I add a key in a thread-safe manner? > I'm not entirely sure, but have you investigated dict.setdefault() ? -- Cheers, Chris -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Question related to multiprocessing.Process

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 3:50 PM, Cen Wang wrote: > Hi, when I use multiprocessing.Process in this way: > > from multiprocessing import Process > > class MyProcess(Process): > > def __init__(self): > Process.__init__(self) > > def run(self): > print 'x' > > p = MyProcess() >

Re: Safely add a key to a dict only if it does not already exist?

2013-01-19 Thread Chris Angelico
On Sat, Jan 19, 2013 at 7:16 PM, Vito De Tullio wrote: > yeah, sure, but with a fixed value :) > > I mean: if the value is not important, why bother at all trying not to > override it with an if or a lock or other tecniques? doing > > d['key'] = 'fixed_value' > > multiple times in different th

Re: Vote tallying...

2013-01-19 Thread Chris Angelico
On Sun, Jan 20, 2013 at 4:46 AM, Tim Chase wrote: > Reading the MySQL gotchas and comparing it to the PostgreSQL gotchas, the > MySQL ones scare the pants off my inner DBA, while the PostgreSQL ones are > mostly "if you're running at 6+yr old version of the software, there are > some peculiar beha

Re: To make a method or attribute private

2013-01-20 Thread Chris Angelico
On Sun, Jan 20, 2013 at 8:17 PM, iMath wrote: > so what is your opinion about single leading underscore and private methods > or attributes? Didn't this get discussed recently? http://mail.python.org/pipermail/python-list/2013-January/638687.html ChrisA -- http://mail.python.org/mailman/listi

Re: To make a method or attribute private

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 12:14 PM, iMath wrote: > so there is no REAL private variable in Python but conversion exists in it > that python programmer should follow and recognize .right ? That's about it. If you think about C++ public members as the "interface" and private/protected members as the

Re: RE Help splitting CVS data

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 11:41 AM, Garry wrote: > Thanks everyone for your comments. I'm new to Python, but can get around in > Perl and regular expressions. I sure was taking the long way trying to get > the cvs data parsed. As has been hinted by Tim, you're actually talking about csv data -

Re: To make a method or attribute private

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 2:27 PM, Steven D'Aprano wrote: > On Sun, 20 Jan 2013 17:14:36 -0800, iMath wrote: > > [...] >> so there is no REAL private variable in Python but conversion exists in >> it that python programmer should follow and recognize .right ? > > There are no "REAL private variables

Re: Else statement executing when it shouldnt

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 3:40 PM, eli m wrote: > an else statement is running when it shouldnt be. It is on the last line. > Whenever i am in the math or game function, when i type in main, it goes back > to the start of the program, but it also says not a valid function. I am > stumped! Check

Re: Uniquely identifying each & every html template

2013-01-20 Thread Chris Angelico
On Mon, Jan 21, 2013 at 6:08 PM, Ferrous Cranus wrote: > An .html page must retain its database counter value even if its: > > (renamed && moved && contents altered) Then you either need to tag them in some external way, or have some kind of tracking operation - for instance, if you require that

Re: Uniquely identifying each & every html template

2013-01-21 Thread Chris Angelico
On Mon, Jan 21, 2013 at 8:19 PM, Ferrous Cranus wrote: > This python script acts upon websites other people use and > every html templates has been written by different methods(notepad++, > dreamweaver, joomla). > > Renames and moves are performed, either by shell access or either by cPanel > a

Re: Else statement executing when it shouldnt

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 2:37 AM, eli m wrote: > Thank you, that solved my problem. Sorry for my posts, i am a noob and this > is my first time posting on here. There's nothing wrong with being a noob, we all start out that way. Want to be one of the people we love to help? Here are some tips: h

Re: need explanation

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 3:06 AM, wrote: > please I need some explanation on sys.stdin and sys.stdout, and piping out Try the documentation or a web search. If that doesn't help, ask a specific question. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows subprocess.call problem

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 12:04 AM, Dave Angel wrote: > Why not just pass all the filenames as parameters in one invocation of > notepad? Assuming Notepad is written reasonably, that'll give it all to you > in one window, instead of opening many separate ones. The OP is talking about Windows Notep

Re: Uniquely identifying each & every html template

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 10:43 AM, Oscar Benjamin wrote: > On 21 January 2013 23:01, Tom P wrote: >> On 01/21/2013 01:39 PM, Oscar Benjamin wrote: >>> This is a very old problem (still unsolved I believe): >>> http://en.wikipedia.org/wiki/Ship_of_Theseus >>> >> That wiki article gives a hint to a

<    16   17   18   19   20   21   22   23   24   25   >