Re: Evaluate coding and style

2009-09-24 Thread Rhodri James
from homedir_exists import checkDir # Do something important checkDir("fred") # Do something else important -=-=-=- In this case, when homedir_exists.py is read in, __name__ will be the name of the module (i.e. "homedir_exists") instead of "__main__", so the original "checkDir(userlist)" won't be executed. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Intercepting binding?

2009-09-24 Thread Rhodri James
ith Steven here. If a tool is going to break on my when I need it (i.e. in the complicated cases), I don't bother using that tool again. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: iterate over list while changing it

2009-09-24 Thread Rhodri James
s to create a new list as you go. new_a = [] for x in a: if x != 3: new_a.append(x) if x == 4: new_a.append(88) # or whatever you intended "push" to mean If you weren't doing the insertion, you could have used a list comprehension and neatened things up a bit. -- R

Re: Regex trouble

2009-09-24 Thread Rhodri James
ixes: long_distance[key1] = value1 You need to allow for the potential leading 1, which can be done with a bit of straightforward string slicing but still puts REs more sensibly in the running. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: toy list processing problem: collect similar terms

2010-09-26 Thread Rhodri James
nking to trim the crossposts. Which you didn't either, I note. The only downside to killfiles is that you have to pay attention or you sometimes get bitten by this stuff. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: EOF while scanning triple-quoted string literal

2010-10-11 Thread Rhodri James
at as the end of a text file. How you get out of that one, I'm not sure, but frankly putting arbitrary binary into a literal string is rather asking for something like this to come and bite you. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-17 Thread Rhodri James
ting places in the standard library, like: import string return set("".join(L)) <= set(string.printable) I've no idea whether this is faster or slower than any of your suggestions. You could "timeit" and see, or you could wait a bit and not optimise prem

Re: Using nested lists and tables

2010-10-28 Thread Rhodri James
what your *question* is here. Perhaps if you showed us what you have tried already we might be better able to divine what problem you're facing? -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: What people are using to access this mailing list

2010-11-03 Thread Rhodri James
some other software or online service? Usenet via my ISP, on comp.lang.python. Using what client (or web client)? Opera (as an NNTP client, not a web client). -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-03 Thread Rhodri James
r broken editor settings have made this (C code) unreadable." -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Python - decode('hex')

2017-02-20 Thread Rhodri James
(or new_data = input() if you're writing Python 3, which you weren't) Since you probably want to do this for your file name too, you might want to pass them as command line parameters to the script. Look up sys.argv[] in the standard library, or the argparse module if you're feeling keen. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: If statement with or operator

2017-02-22 Thread Rhodri James
t are true in a boolean context. if attempt_umount() or df_output_lines(): is far more likely to do what you expect. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Odd wording it docs for shutil.move?

2017-03-03 Thread Rhodri James
The shutil.move documentation talks about the *current* filesystem, not the filesystem on which is located. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Issues with in try except and excel spreadsheet

2017-03-13 Thread Rhodri James
though honestly the execfile makes me feel icky for unrelated reasons. I repeat, though; this isn't a loop, and my crystal ball isn't up to telling me how it gets invoked. FYI: The assetMapping.py runs another module from inside, and it's this module running from ass

Re: Issues with in try except and excel spreadsheet

2017-03-14 Thread Rhodri James
On 13/03/17 20:37, padawanweb...@gmail.com wrote: On Monday, March 13, 2017 at 11:10:36 AM UTC-7, Rhodri James wrote: On 13/03/17 17:40, padawanweb...@gmail.com wrote: Hello, I'm having a problem with a try except inside a while loop. The problem I see occuring has to do with an excel

Re: Issues with in try except and excel spreadsheet

2017-03-14 Thread Rhodri James
7;m not going to hunt through your code for the answer, because there's too much of it and frankly the overly long lines don't survive email well on my machine. However, you should look for the tidying up in your code that doesn't get done because the attempted write throws an exception. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Who are the "spacists"?

2017-03-21 Thread Rhodri James
ve a notable place in a museum. You misunderstand; well-written code has a pleasing shape all of its own, never mind any deliberate attempts at diagramming. You may be correct that it is only true in the Monospaced Kingdom; if so, that's a major plus point for fixed-width fonts. -- Rh

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-30 Thread Rhodri James
On 30/03/17 16:57, Mikhail V wrote: Steve, it is not bad to want to spell your name using spelling which was taught you in the school. But it is bad to stay in illusion that there is something good in using accents. *plonk* -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman

Re: Data exchange between python script and bash script

2017-04-04 Thread Rhodri James
better off finding and reading a decent shell scripting tutorial. Pay particular attention to piping, which appears to be what you are trying to reinvent. If all else fails, Read The Fine Manual; it's not the easiest of reads, but it does contain all the information you need. --

Re: Bigotry (you win, I give up)

2017-04-25 Thread Rhodri James
y the moon and that people awake and sleep with the sun is also fake? The influence of Jupiter, Saturn, etc is — for astrology-buffs at least — just a refinement of the influence of the sun, moon Mostly it's irrelevant. Kindly stop. -- Rhodri James *-* Kynesim Ltd -- https://mail.pyt

Re: Array column separations for beginners

2017-04-26 Thread Rhodri James
it to your output file. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: ValueError: Input contains NaN, infinity or a value too large for dtype('float32')

2017-04-27 Thread Rhodri James
7;). Process finished with exit code 1 Description : Can any one help with the error message. It means exactly what it says. One of the values in your testDataVecs (I assume) is not a number, infinite or too big for a 32-bit IEEE float to represent. You may be using the sklearn package

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread Rhodri James
ython newsgroup is unmoderated and cannot do such filtering. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Help Please ! Undocumented ERROR message so dont know how to fix the problem

2017-05-02 Thread Rhodri James
ult of calling it, since you *don't* call it. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: How to install Python package from source on Windows

2017-05-17 Thread Rhodri James
c, clang, MSVC, etc. That no one else put in the work for TCC just indicates that no one else thought it was worth while. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: How to install Python package from source on Windows

2017-05-17 Thread Rhodri James
On 17/05/17 14:53, bartc wrote: On 17/05/2017 13:35, Rhodri James wrote: On 17/05/17 01:41, bartc wrote: As a cross-platform developer, I find your naivity refreshing. If only life were so simple. When you develop code yourself, you can lay out your files however you find most convenient

Re: How to install Python package from source on Windows

2017-05-18 Thread Rhodri James
ising configure scripts with that file, and (b) I think you may be making assumptions about non-aligned pointers that will kill you on ARM3, and are horribly inefficient elsewhere. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Verifiably better, validated Enum for Python

2017-05-26 Thread Rhodri James
the standard generally means by "undefined". Anyone doing cross-platform work should avoid it like the plague it will become to them. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Hello from a super noob!

2017-06-08 Thread Rhodri James
ague (or indeed a soft toy) why your code cannot possibly be wrong, is an excellent way of finding bugs. The number of times I've stopped in the middle of an explanation to fix the now glaringly obvious mistake... Try it and see. Here's a hint: be very aware of what your indent

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-15 Thread Rhodri James
and doesn't have a single obvious mapping to most people's data transfer needs. However when you need that extra flexibility, it's wonderful, and it doesn't *have* to be complex. Of course, all this assumes you don't want the efficiency of a bespoke binary protocol. L

Re: Error

2017-06-29 Thread Rhodri James
reply doesn't contain any JSON. Have you tried dumping the response out to see exactly what was sent? -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Python threading and sharing variables

2017-07-05 Thread Rhodri James
ld be atomic without some hint of proof :-) -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Privy: An easy, fast lib to password-protect your data

2017-07-06 Thread Rhodri James
, which is just plain rude. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Test 0 and false since false is 0

2017-07-11 Thread Rhodri James
t an implementation detail. True and False are singletons, and are different objects from 1 and 0 (they behave differently when converted to strings, for example). Now, relying on "0 is 0" being true would be relying on an implementation detail, but you weren't going to do that, were you? -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Test 0 and false since false is 0

2017-07-12 Thread Rhodri James
the objects 1 and 0. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3.5 raiaing an error when import the class Manager in this module sayning name Manager is not define

2017-07-13 Thread Rhodri James
n't recognize the Manager class? It does for me. Have you tried Peter's suggestion of typing >>> import person >>> person.__file__ into IDLE? It is very likely that you are not picking up the "person.py" that you think you are. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Write this accumuator in a functional style

2017-07-13 Thread Rhodri James
based hw. Doubly so for "managed" languages where gc buys space for time. You might want to do some benchmarks to sound out that idea. I believe conventional wisdom is that the time cost of allocating more memory and extending the list outweighs the space cost of wasted memory. -- Rh

Re: Process in not get killed using subprocess.call() in python thread

2017-07-13 Thread Rhodri James
y best if you don't run the thread in an infinite loop when you do that. Why are you doing that anyway? -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Grapheme clusters, a.k.a.real characters

2017-07-14 Thread Rhodri James
extra layer of complexity to all of the questions you were asking, and more. A single codepoint is a meaningful thing, even if its meaning may be modified by combining. A single byte may or may not be meaningful. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Grapheme clusters, a.k.a.real characters

2017-07-14 Thread Rhodri James
On 14/07/17 15:32, Michael Torrie wrote: On 07/14/2017 08:05 AM, Rhodri James wrote: On 14/07/17 14:31, Marko Rauhamaa wrote: Of course, UTF-8 in a bytes object doesn't make the situation any better, but does it make it any worse? Speaking as someone who has been up to his elbows in

Re: Grapheme clusters, a.k.a.real characters

2017-07-14 Thread Rhodri James
On 14/07/17 15:14, Marko Rauhamaa wrote: Rhodri James : On 14/07/17 14:31, Marko Rauhamaa wrote: Of course, UTF-8 in a bytes object doesn't make the situation any better, but does it make it any worse? Speaking as someone who has been up to his elbows in this recently, I woul

Re: Grapheme clusters, a.k.a.real characters

2017-07-17 Thread Rhodri James
" (H.L. Mencken). Unfortunately grandmothers outside their areas of expertise are particularly prone to finding those answers. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Funding continuous maintenance for PyInstaller?

2017-07-18 Thread Rhodri James
t, so I'm a tad biased. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Rhodri James
On 18/07/17 15:10, Rustom Mody wrote: On Monday, July 17, 2017 at 10:14:00 PM UTC+5:30, Rhodri James wrote: On 17/07/17 05:10, Rustom Mody wrote: Hint1: Ask your grandmother whether unicode's notion of character makes sense. Ask 10 gmas from 10 language-L's Hint2: When in doubt gma

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Rhodri James
s I recall southern Irish displacing Picts in Scotland, and then the Norman French (themselves starting from Vikings ["nor(se)man"]). Sorry, but even the Gaels/Gauls were invaders :-) -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Rhodri James
less, the rule of using a double consonant after a short vowel in contexts where a single consonant would suggest the preceding vowel was long. The single/double consonant rule is indeed an ancient Germanic spelling principle. English makes several twists to the it: It's not so much a rule as a

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rhodri James
On 19/07/17 09:17, Steven D'Aprano wrote: On Tue, 18 Jul 2017 16:37:37 +0100, Rhodri James wrote: (For the record, one of my grandmothers would have been baffled by this conversation, and the other one would have had definite opinions on whether accents were distinct characters o

Re: Grapheme clusters, a.k.a.real characters

2017-07-20 Thread Rhodri James
s, or Newtonian mechanics breaks down near the speed of light, or pretty much everything intuitive breaks down at quantum scales. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Basic python understanding

2017-07-27 Thread Rhodri James
7;s your man. If you want Python-based unit tests for it, don't ask him. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Challenge: find the first value where two functions differ

2017-08-04 Thread Rhodri James
re sensible, but what the heck. That's only (!) 9007199523176448 values to test, which my machine seemed to be quite happy with, but you could repeat the exercise with more layers if you really wanted to. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Case-insensitive string equality

2017-08-31 Thread Rhodri James
The only way I can think of to get much traction with this is to have a separate case-insensitive string class. That feels a bit heavyweight, though. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there tested Python code for parsing N-Triples?

2017-08-31 Thread Rhodri James
rg/moin/RdfLibraries) there are several RDF libraries. I don't know how formally tested they are. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Re: Case-insensitive string equality

2017-08-31 Thread Rhodri James
certainly start with a Unicode normalization. But should it be NFC/NFD or NFKC/NFKD? IMO that's a good reason to leave it in the hands of the application. There's also the example in the documentation of str.casefold to consider. We would rather like str.equal("ß", "ss&q

Re: python logic

2017-09-01 Thread Rhodri James
;> r = 13 >>> eval('r') 13 Going back to your question, what you want to do is to use the function raw_input() and compare the input to the strings "1" and "2" (because that input is a string, remember?). You could use the function int() to convert the

Re: Python string replace the values

2017-09-01 Thread Rhodri James
final_string = fixed_string + user_string.zfill(4) 'a0001' Note you should think VERY CAREFULLY about any user input like this. What are you going to do the user gives you too many digits, too few digits, non-digits? -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

<    4   5   6   7   8   9