*want* an easy name() function -
there's a lot of potential for abuse - but I would at least like to
see it accomplished before I decide whether I like it or not.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
that mixing data with program code is a bad idea)
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 29 Mar 2005 18:08:04 GMT, Cameron Laird [EMAIL PROTECTED] wrote:
In article [EMAIL PROTECTED],
Bill Mill [EMAIL PROTECTED] wrote:
.
.
.
(i.e. I respectfully disagree that mixing data with program code is a bad
language
in python. If you do this, it doesn't matter which of the three you
pick.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
uses of reflection, eval, and exec.
I was too glib in my response to you. I intended no disrespect, only silliness.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
) - 1
e = enumerate(s)
for i,c in e:
if i l and s[i+1] == '/':
e.next()
i2, c2 = e.next()
yield [c, c2]
else:
yield [c]
for g in xgen('ATT/GATA/G'): print g
...
['A']
['T']
['T', 'G']
['A']
['T']
['A', 'G']
Peace
Bill Mill
On Mon, 28 Mar 2005 09:18:38 -0800, Michael Spencer
[EMAIL PROTECTED] wrote:
Bill Mill wrote:
for very long genomes he might want a generator:
def xgen(s):
l = len(s) - 1
e = enumerate(s)
for i,c in e:
if i l and s[i+1] == '/':
e.next
chose
stack just to point out how similar the solution to objection 2 was to
yours.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
('.')
for x, y in zip(v1, v2):
if x y: return v1
if y x: return v2
It assumes that v1 and v2 have the same amount of '.'s and that all of
the version numbers are of the same length (i.e. 1.1000 would be
1.999). How general do you need to be?
Peace
Bill Mill
bill.mill at gmail.com
that for a productivity boost?
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
to tell us what your
specific problems were, so that we can help you more.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
On 24 Mar 2005 10:29:40 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
I am new to python and learning it. Can you please give me a simple
example of user defined type through class mechanism.
GIYF:
http://www.python.org/2.2/descrintro.html#subclassing
Peace
Bill Mill
bill.mill at gmail.com
On 21 Mar 2005 12:47:07 -0800, Paul McGuire [EMAIL PROTECTED] wrote:
Brian,
Having reviewed your Cease and Desist petition, I'm afraid I must
dispute some or all of your claims:
1. Your citation of prior art has one or more significant defects:
a. In your citation, brace is clearly rhymed
. To define a
one-tuple, put a comma after the '1':
type(('1',))
type 'tuple'
Because I have to treat this special case differently in my code.
you shouldn't have to; post your code if you still think you do.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python
is particularly appealing; a lone comma creating a data
structure seems counter-intuitive, but it's nice to do a, b = b, a
instead of (a, b) = (b, a) . In this case, since the need to create
empty tuples is vanishingly rare, I'm okay with a little
inconsistency.
Peace
Bill Mill
bill.mill at gmail.com
editors (when not away on vacation) read planet python, and they'll
send thousands of visitors to you if they link you.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
because it introduces magic. When reading code, you just need to
magically know what the double-comma does in a print statement. Yes,
there are bits of magic involved in the solutions that already exist,
but I am opposed to the introduction of more.
Peace
Bill Mill
bill.mill at gmail.com
--
http
= bigscaryfunction()
or:
def sget(dict, key, func, *args):
if key in dict: return key
else: return func(*args)
sget(d, 'x', bigscaryfunction)
Both methods are untested, but should work with minor modifications.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python
of:
z = d.get('x', test)
z
function test at 0x008D66B0
I just wanted to ask, am I missing something?
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
*a : scary())())
scary called
22
but:
d.get('x', (lambda *a: test())())
test called
1
So how is this different than d.get('x', test()) ?
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
kinds of confusing for a reader.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
stuff, I found IPython
(http://ipython.scipy.org/) to be an invaluable tool. It's a much
improved Python interpreter.
Peace
Bill Mill
bill.mill at gmail.com
(In Matlab, integer_matrix is always a double anyway, here I would like
only to show the vector-matrix operation).
Obviously, Python
heuristics, problems that you can expect people to solve will almost
always fall to brute force algorithms, I feel.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
-
real0m1.255s
user0m1.221s
sys 0m0.030s
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
Earl,
Please post the smallest snippet of code you can which illustrates
your problem. No list is an unsubscriptable object, so you seem to be
passing something that is not a list to your function.
As it stands, you don't give enough information to give an actual answer.
Peace
Bill Mill
')
Please read the python tutorial at http://docs.python.org/tut/tut.html .
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
]
found_words
['word1', 'word2']
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 11 Feb 2005 12:11:44 -0700, Steven Bethard
[EMAIL PROTECTED] wrote:
Is there a good way to determine if an object is a numeric type?
Generally, I avoid type-checks in favor of try/except blocks, but I'm
not sure what to do in this case:
def f(i):
...
if x i:
#SECTION00714 .
Peace
Bill Mill
bill.mill at gmail.com
On Tue, 08 Feb 2005 06:50:08 -0800 (PST), Jim [EMAIL PROTECTED] wrote:
Where did this type of structure come from:
mat = ['a' for i in range(3)]?
This will produce a list of three elements but
I don't see reference
Chad,
try elif tries == 2 or just else:. You are not allowed to put an
expression after an else statement.
I recommend you read the python tutorial at
http://docs.python.org/tut/tut.html .
Peace
Bill Mill
bill.mill at gmail.com
On Fri, 4 Feb 2005 12:49:51 -0600, Chad Everett [EMAIL PROTECTED
on an array while it's
being iterated over. Since the iterator is only created once, you're
can't change the array while you're iterating over it. Instead, try a
list comprehension:
ips = [ip for ip in ips if '255' not in ip]
ips
['128.173.120.79', '198.82.247.98', '127.0.0.1']
Peace
Bill Mill
know about. I vote it
goes in Dr. Dobbs newsletter.
Once you know it, it's neat, and I use it sometimes. However, it's a
little too magical for my tastes; I'd rather be more explicit about
what's going on.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo
that the list comprehension is the best.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
Brent,
You could write the Python program as a proxy of the internet stream.
Basically, you would point your proxy at the web stream and receive
the data it sends. At the same time, you would be listening for
connections on some socket on the local machine. You would then point
winamp towards the
an example or two, and I'll translate
it for you. I don't feel like going to read the java docs to figure it
out.
You probably want to look at the built-in int() function though. Type
help(int) at the python prompt.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo
function?
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
On 28 Jan 2005 15:41:49 GMT, F. Petitjean [EMAIL PROTECTED] wrote:
Le Fri, 28 Jan 2005 10:20:30 -0500, Bill Mill a écrit :
Hello all,
I have a misunderstanding about dynamic class methods. I don't expect
this behavior:
In [2]: class test:
...: def __init__(self, method
that you could call types to create another type.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
.
Thanks, you helped me understand it a lot.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
:
|class Test:
|def __init__(self):
|self.method()
|
|def m(self):
|print self
|
|setattr(Test, 'method', m)
|Test()
beautiful; so this appears to be equivalent to the __class__ method
that Hans suggested.
Thanks a lot.
Peace
Bill Mill
bill.mill at gmail.com
--
http
On Fri, 28 Jan 2005 11:59:50 -0500, Hans Nowak [EMAIL PROTECTED] wrote:
Bill Mill wrote:
On Fri, 28 Jan 2005 11:09:16 -0500, Hans Nowak [EMAIL PROTECTED] wrote:
snip
To add m as a new method to the *class*, do this:
class test:
... def __init__(self, method):
... self
)
Sometime Python makes things easier than people are initially willing to
believe ;-)
I felt like there had to be a simpler solution.
Peace
Bill Mill
bill.mill at gmail.com
--
http://mail.python.org/mailman/listinfo/python-list
read this thread, it should help you:
http://mail.python.org/pipermail/tutor/2005-January/035124.html
Peace
Bill Mill
bill.mill at gmail.com
On Tue, 25 Jan 2005 02:15:58 +, Frans Englich
[EMAIL PROTECTED] wrote:
Hello all,
Due to the size of my source, I want to split it up
/mos user wmarch, cd /fa/wm/%s/%s, mkdir %s, put %s'\
... '%s' % (mosbin, jaar, filetype, filetype, filetype, filetype)
cmd
'1/mos user wmarch, cd /fa/wm/1/1, mkdir 1, put 1, chmod 6441'
Peace
Bill Mill
bill.mill at gmail.com
On Wed, 19 Jan 2005 16:16:32 +, Nader Emami [EMAIL PROTECTED] wrote
You are correct, sir. Didn't know you could do that. Neato.
Peace
Bill Mill
bill.mill at gmail.com
On Wed, 19 Jan 2005 22:10:05 +0100, Fredrik Lundh
[EMAIL PROTECTED] wrote:
Bill Mill wrote:
You've got a couple problems. First, you need to end the string before
putting a continuation
an
additional x.index() call.
Peace
Bill Mill
bill.mill at gmail.com
On Wed, 19 Jan 2005 22:04:44 -0500, Bob Smith
[EMAIL PROTECTED] wrote:
Hi,
I have a Python list. I can't figure out how to find an element's
numeric value (0,1,2,3...) in the list. Here's an example of what I'm doing:
for bar
101 - 146 of 146 matches
Mail list logo