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
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
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
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
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
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
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
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
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
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
(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
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
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
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
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
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
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
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
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.
--
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
it to your output file.
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
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
ython newsgroup is unmoderated and cannot do such
filtering.
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
ult of calling it, since you *don't* call it.
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
ld be atomic without some
hint of proof :-)
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
, which is just plain rude.
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
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
the objects 1 and 0.
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
" (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
t, so I'm a tad biased.
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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 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
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
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
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
;> 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
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
801 - 855 of 855 matches
Mail list logo