() it.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
an explicit return value it returns None.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
, all with the same core but
with some stuff turned off.)
Python isn't ready for this. Not with the GIL.
Is any language, save perhaps Erlang, really ready for it?
occam :-)
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
,
parsing is the only sensible answer.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
bindings to the libraries that
might help depending on exactly how you are streaming your video.
Unfortunately the documentation is sparse to put it mildly, and pyffmpeg
makes tstools look positively informative about how you're supposed to use
it.
--
Rhodri James *-* Wildebeeste Herder
more about what you mean when you say the effect of
errors? It's easy enough to introduce bit errors into a data file (just
flip random bits), but I'm not clear what it is you're trying to measure.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman
(if
obviously wrong) image surprisingly quickly.
PS: my first name is Rhodri, not James. Don't worry, it catches a lot of
people out.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
technical trickery.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 26 Feb 2010 23:32:27 -, Raphael Mayoraz may...@netplus.ch
wrote:
I'd like to define variables with some specific name that has a common
prefix.
Why?
No seriously, how do you think this is going to solve whatever problem you
clearly think it will solve?
--
Rhodri James
. In the
example
I give, I would get 3 variables:
myPrefixred = a
myPrefixgreen = b
myPrefixblue = c
I repeat my previous question: why? What problem do you think this will
solve that will not be more easily solved working with the language rather
than against it?
--
Rhodri James
:-)
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
:
block
except:
pass
-100
This catches Control-C interrupts, sys.exit(), subtle typos in the code,
and sundry other errors that actually you *did* want to know about.
Silence isn't so much golden as pyritic.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http
as they
are.
I am also not think about names as reference to objects and so on.
Then you are doomed to surprises such as this.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
of it being an *anonymous* function! What are you actually
trying to do here? There's almost certainly a better way to do it than
this.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
this. Speed is not a big
deal in this. As to malicious input, I could pretty easily check to
see that all the values are integers.
If you've done that check, you've parsed the input so you might as well
use the values you've derived rather than waste time and add risk by
using eval().
--
Rhodri
to ask: *what* complains
that the file is not in the right format? Also, I don't think you
meant frep that second time, but your typing is sufficiently awful
I can't be sure.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
the
case, this ought to help:
import re
x = 00122
m = re.match(r(0*)(1*)(2*), x)
m.groups()
('00', '1', '22')
y = 00111
m = re.match(r(0*)(1*)(2*), y)
m.groups()
('00', '111', '')
You'll have to filter out the empty groups for yourself, but that's
no great problem.
--
Rhodri James
On Sat, 05 Sep 2009 23:54:08 +0100, per perfr...@gmail.com wrote:
On Sep 5, 6:42 pm, Rhodri James rho...@wildebst.demon.co.uk wrote:
On Sat, 05 Sep 2009 22:54:41 +0100, per perfr...@gmail.com wrote:
I'm trying to efficiently split strings based on what substrings
they are made up of.
i have
example code, but it's nearly 1am and I'd be sure
to commit fence-post errors at this time of night.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
variation within the dialectal family of English to make an
attempt to render it phonetically much use.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 15 Sep 2009 14:39:04 +0100, LinkedIn Communication
communicat...@linkedin.com wrote:
LinkedIn
[snippety snip]
Methinks the spam filter needs updating.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
l = line.split()
instead of
l = line.split(' ')
and not getting the empty strings in the first place.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
=True)
stderr = pipe.stdin.write(password)
time.sleep(1)
stderr = pipe.stdin.write(password)
if pipe.stdin.close != 0:
Did you perhaps mean if pipe.stdin.close(): ?
Does it help if you read stdout rather than sleeping for arbitrary periods?
--
Rhodri James
On Mon, 21 Sep 2009 21:49:50 +0100, daggerdvm dagger...@yahoo.com wrote:
you brain needs error checking!
Your post, by contrast, needs grammar checking.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
) recollection that explicit
yielding was what made them coroutines rather than general cooperative
multitasking.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
return result
Note that this won't work on the 'sec' field, since it's a number rather
than a string.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
()
chips.spam = Foo()
spam[eggs.beans['chips']] = Foo()
spam.append(Foo())
and so on.
The thing to google for is Python's assignment model, because it's
probably not what you think it is.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
, I'm being
very dim tonight.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
for
trouble when you carry blithely on with mis-shapen data.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
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
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
.
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.
--
Rhodri James *-* Wildebeest Herder to the Masses
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
awfully easy to
end up with rows being the same list object if you're careless, and then
unexpected things happen :-)
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
and shoulders above the 8-bit PIC
family.]
I was going to say, you want 256 bytes of RAM, you profligate
so-and-so? Here, have 32 bytes of data space and stop your
whining :-)
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
, every educator who comes along afterwards
will curse your name. That includes teaching yourself.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
like:
grouped acc: 61
grouped acc: 64
then you're going to have to sort your info_list first. That might
not be desirable, depending on just how long it is. If you tell us
more about your specific use case, we may be able to give you more
specific advice.
--
Rhodri James *-* Wildebeest Herder
variable, you change what the program will
do in the future, usually in fairly major ways that may not be visible
from wherever your assignment takes place.
I'm hardly an expert in the area, but that does seem to be the point
of a lot of object-oriented design.
--
Rhodri James *-* Wildebeest Herder
of the month rather
than the start, which makes the last day of January and January 31
not the same thing really. Unfortunately we're very fuzzy about when
we do things like this, which makes it hard on a poor programmer.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman
of religious debate :-)
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/361668
3. web2py codebase: Storage(dict)
I enclosed the three implementations below.
My question to the Python specialists: which one is the most correct?
Accessing the dictionary as a dictionary.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http
.
Look in the What's New documents, starting with
http://docs.python.org/3.1/whatsnew/3.0.html
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
you read the documentation at all?
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 14 Oct 2009 02:26:17 +0100, Mensanator mensana...@aol.com wrote:
On Oct 13, 5:38�pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Tue, 13 Oct 2009 22:59:04 +0100, Mensanator mensana...@aol.com
wrote:
And I'm not saying John nor the OP should stop
using what works for them
like
that if you don't need to. However, generally speaking a function will
expect a tuple or not; libraries that can cope with either are the
exception rather than the rule.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
.
_pass = md5.new()
Other way round; you put the underscore at the end according to PEP-8
(http://www.python.org/dev/peps/pep-0008/)
pass_ = md5.new()
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
for the 're' module at python.org is your friend!
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
get any sympathy from here.
The safe answer is to write yourself a small parser. Given that
you've got a very limited symbol set, that shouldn't be too hard.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
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
On Fri, 19 Jun 2009 14:24:34 +0100, Aaron Brady castiro...@gmail.com
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
:
test = A()
self.obj = A()
and so on.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
to re.match() and the 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
PEP 378 got in 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
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
of that paragraph, Martin!
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 29 Jun 2009 06:07:19 +0100, Eric S. Johansson e...@harvee.org
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
On Mon, 29 Jun 2009 20:28:07 +0100, Eric S. Johansson e...@harvee.org
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
to be smart enough
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 30 Jun 2009 09:57:27 +0100, Rhodri James
rho...@wildebst.demon.co.uk wrote:
On Tue, 30 Jun 2009 03:37:15 +0100, Eric S. Johansson e...@harvee.org
wrote:
Steven D'Aprano wrote:
Why do you think a smart editing environment is in opposition to coding
conventions? Surely an editor
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
.
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
pygame.image.load() to load 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
/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) 1:
# Do your stuff
--
Rhodri James
, 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 two). From
there it's just one small step...
:-)
--
Rhodri James
of abstraction, 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
programming.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
the webcam claims to deliver.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 06 Jul 2009 18:41:03 +0100, jack catcher (nick) nom...@thank.you
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
() over re.search() are
considered worth the (small) increase in size.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
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
On Mon, 06 Jul 2009 17:54:35 +0100, Dave Angel da...@ieee.org 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 programming.
But the C
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
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
say for sure.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
know what 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 *-* Wildebeest
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
as a tool kit for the
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
On Sat, 11 Jul 2009 05:17:18 +0100, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
On Fri, 10 Jul 2009 13:25:49 +0100, Rhodri James
rho...@wildebst.demon.co.uk declaimed the following in
gmane.comp.python.general:
On Thu, 09 Jul 2009 11:52:44 +0100, m.reddy prasad reddy
reddy@gmail.com
at www.python.org rather than tell you exactly how.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
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
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
, 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
On Tue, 21 Jul 2009 17:12:53 +0100, Peter Fodrek peter.fod...@stuba.sk
wrote:
21.7.2009 v 17:39, Rhodri James:
On Tue, 21 Jul 2009 14:30:47 +0100, Peter Fodrek peter.fod...@stuba.sk
wrote:
[snipped for space]
This handles text file like
// remark
PL_OFF
PARK
FS
MA 52.8806 , 18.0914
On Wed, 22 Jul 2009 06:02:55 +0100, Gabriel Genellina
gagsl-...@yahoo.com.ar 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
code and 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
On Thu, 23 Jul 2009 01:05:55 +0100, Gabriel Genellina
gagsl-...@yahoo.com.ar wrote:
En Wed, 22 Jul 2009 11:01:09 -0300, Rhodri James
rho...@wildebst.demon.co.uk escribió:
On Wed, 22 Jul 2009 06:02:55 +0100, Gabriel Genellina
gagsl-...@yahoo.com.ar wrote:
class X(object):
foo
) should return 0.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
on the scene. While the OP appears to have the right idea,
your correction here could be quite misleading.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 24 Jul 2009 16:10:07 +0100, Piet van Oostrum p...@cs.uu.nl wrote:
Rhodri James rho...@wildebst.demon.co.uk (RJ) wrote:
RJ On Fri, 24 Jul 2009 14:57:02 +0100, Grant Edwards inva...@invalid
wrote:
On 2009-07-24, Dr. Phillip M. Feldman pfeld...@verizon.net wrote:
Some aspects
On Fri, 24 Jul 2009 16:03:58 +0100, Piet van Oostrum p...@cs.uu.nl wrote:
Rhodri James rho...@wildebst.demon.co.uk (RJ) wrote:
RJ On Fri, 24 Jul 2009 14:55:45 +0100, Hrvoje Niksic
hnik...@xemacs.org wrote:
Ben Finney ben+pyt...@benfinney.id.au writes:
Utpal Sarkar doe...@gmail.com
that you are spending
so much time complaining about.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
(myfile.txt, r) instead, the
line endings are converted to \n on both Windows and Linux.
If my crystal ball has proved faulty, giving us more details will help
get a more sensible answer.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
of where it
lives in the web application structure -- the part of the language that
was thought about very hard. Beyond that there's nothing much to master,
so the whole ease vs power debate is rather pointless.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman
fighting the language unnecessarily here. If
you have a sequence of functions that you want a sequence of results
out of, you should be thinking in terms of a sequence type. A list,
in other words.
results = []
for f in fn1, fn2, fn3:
results.append(f())
--
Rhodri James *-* Wildebeest Herder
all that you can say.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
; even then, if it does make a significant
difference then you needed greater resolution anyway.
--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
are grobbling about with hardware, and
if you are doing that, Python wasn't the best place to start from.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 21 Jun 2010 04:34:40 +0100, Steven D'Aprano
steve-remove-t...@cybersource.com.au wrote:
On Sun, 20 Jun 2010 22:45:14 +0100, Rhodri James wrote:
No. Modern C compilers often produce very good machine code, but the
best hand-written assembly code will be better. I can usually write
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
syntactically-correct 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
201 - 300 of 855 matches
Mail list logo