good grounding
> in the basic concepts.
>
> http://docs.python.org/tut/>
>
The values in the example are sequentially ordered wrt the keys, which
is perhaps what the OP intends.
c = dict(((k,v) for (v,k) in enumerate(x for x in sorted(a.keys()) if
b.has_key(x
But, yes,
>
I think you are wrong. The new trend is toward absolutely no instruction
at all and the students must guess the assignment. In this regard, I
believe the OP is doing very well. Don't you think?
James
--
http://mail.python.org/mailman/listinfo/python-list
he loop variable
> when executing the "def" statement.
>
> Andrea
Yet another way to skin the same cat, maybe even less ugly, depending on taste.
def make_inner(i):
def inner():
return i
return inner
def functions():
return [make_inner(i) for i in range(5)]
pri
a bit more
complicated than this one.
Any thoughts?
James
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> I think that it would be handy for enumerate to behave as such:
>
> def enumerate(itrbl, start=0, step=1):
> i = start
> for it in itrbl:
> yield (i, it)
> i += step
>
> This allows much more flexibility than in the current enumerate,
ially become a divisor or perhaps the operand
in a logarithm.
James
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> def enumerate(itrbl, start=0, step=1):
>>i = start
>>for it in itrbl:
>> yield (i, it)
>> i += step
>
> that's spelled
>
> izip(count(start), sequence)
>
> in to
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> The code is for an economist. She is insistent on starting with the
>> first bin as 1.
>
> leaky abstractions in reverse, in other words? that's not a good design
> approach.
>
>
>
I'm not sure I
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> The code is for an economist. She is insistent on starting with the
>> first bin as 1.
>
>
> leaky abstractions in reverse, in other words? that's not a good design
> approach.
>
>
>
Okay, I'
o much criticism, I challenge even the most skilled python
programmer to find his or her own faculty economist (or statistician or
physicist) and get them to radically change their computational tools.
When you've walked a mile in my shoes, leaky abstractions won't seem
like such a b
Steve Holden wrote:
> How could you end up marrying
> someone who counts from one and not zero? ;-)
She's the only other person I've ever met who used vi key binding at the
command line.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los A
;
> words = ["the"]
> x = SearchParser(words)
> data = file("input.htm").read()
> x.feed(data)
> if x.found:
> y = HightLightParser(file("output.htm", "w"),words)
> y.feed(data)
>
google "google".
Seriously though, perhaps you may want to index your pages first. Maybe
checkout divmod (http://divmod.org/trac/wiki/DivmodXapwrap).
James
--
http://mail.python.org/mailman/listinfo/python-list
the standard library and (2) using google.
http://docs.python.org/lib/module-csv.html
James
--
http://mail.python.org/mailman/listinfo/python-list
[0-9]" at the end. but this is optional
>
> can any one please help me out pls
>
>
> Teja.P
>
This is as general as could be constructed given your vague requirements:
"[a-zA-Z][a-zA-Z0-9_]+"
You may need to provide examples.
James
--
James Stroud
U
, something like this would be possible:
>
>
>>>>WeatherData.max_time
>>>>[0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.10,0.11,0.12]
>
>
> Any help would be appreciated.
>
setattr(Weatherdata, "max_time", max_time)
--
James S
[EMAIL PROTECTED] wrote:
> James Stroud wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>I have a text file that I am parsing. Each line is of the form:
>>>
>>>max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
>>>
>>>
nality. But, I'm curious about how people see such a beast
working, though. Please don't criticize unless you have a better idea
about the API of a Table. I want to hear genuine and concrete ideas and
not abstruse pontification about programming or design! Statements of "I
wouldn't do this thing here" should be immediately followed by
"--rather, I would do this other thing for which I've created a concrete
example below."
If you think this interface is genius, well my ego wants to hear about
that as well, but its not terribly necessary.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
0:2] # if we know what column numbers we want instead
>
> t[1:3][0:2] and so on would be more intuitive to me, possibly
> t[1:3]['First':'Age']
This looks better than my slicing, and to argue with it I'd have to
break my own rules and point out that it would require making an
intermediate table in the implementation. I am emulating numarray
slicing closely, which itself is probably focused on implementation and
speed.
James
--
http://mail.python.org/mailman/listinfo/python-list
RobJ wrote:
> Hi! My Name is Rob Johnson and I am a graduate student at The Richard
> Stockton College of NJ. To make a long story short, I'm working on my
> Masters project in the MAIT program (Masters of Arts in Instructional
> Technology). I have written a proposal to put together a free on-line
e
>dt_customers = ds.tables["customers"]
>view = DataView( dt_customers )
>view.rowfilter = "lastname LIKE 'A*' and Age < 60"
>
> I'm not saying imitate this, but maybe some value in studying the
> OO-bondage approach.
Thank you, this is very good stuff to think about.
James
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi, I have a list of strings. And I want to find the subset which
> matches a particular regular expression.
>
> import re
> ll = ('a', 'b', 's1', 's2', '3s')
> p = re.compile('^s.*')
> newList = filter(lambda s: p.match(s), ll)
>
> I suppose there should be simple func
gt;
>
> Thx,
> Ernesto
print ",".joint(some_list)
Where what you have named "list" is now called "some_list" because it is
terribly ill-advised to reassign the name of a built-in type.
James
--
http://mail.python.org/mailman/listinfo/python-list
ith
> tkFileDialog. Does someone have a solution for that?
import tkFileDialog
afile = tkFileDialog.askopenfile()
print afile.name
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
On 2006-11-10 15:24:50 -0500, Bjoern Schliessmann
<[EMAIL PROTECTED]> said:
> Marc 'BlackJack' Rintsch wrote:
>
>> No it doesn't -- look again at the example given above. It's
>> legal syntax in Python but doesn't have the semantics implied by
>> the example.
>
> Sorry, I don't understand -- w
hear of it.
Don't you know that with insufficient test cases, everything is right? Sheesh.
Best,
James
--
http://mail.python.org/mailman/listinfo/python-list
Carbon), and GTK; it does not wrap
Qt. On this page is a list of WxWidgets ports:
http://wiki.wxwidgets.org/docbrowse.cgi/wxwin_wxplatforminfo.html
According to the WxWidgets wiki, there's nothing stopping a person from
writing a Qt port.
http://www.wxwidgets.org/wiki/index.php/WxWidgets_
def adjust_attributes(self):
self.health += self._health_char_inc + self_health_base_inc
self.armor += self._armor_char_inc + self._armor_base_inc
# etc
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
om or something.
>
> -Jeff
Dirt-cheap Dreamhost also offers Python with Django (as well as Ruby
with Rails), though I haven't used those capabilities so I can't judge
how good the environment is. I suspect it isn't that great. The people
at Dreamhost are great; the service its
eamhost. But with deals
you can get it down to about that low, at least for the first year. I
suppose I'm lucky enough not to miss $8 a month otherwise.
Best,
James
--
http://mail.python.org/mailman/listinfo/python-list
On 2006-11-16 05:46:45 -0500, Steve Holden <[EMAIL PROTECTED]> said:
> James Cunningham wrote:
>> On 2006-11-15 20:59:26 -0500, "walterbyrd" <[EMAIL PROTECTED]> said:
>>
>>> Bruno Desthuilliers wrote:
>>>> walterbyrd a écrit :
>>
On 2006-11-16 09:08:43 -0500, Steve Holden <[EMAIL PROTECTED]> said:
> James Cunningham wrote:
>> On 2006-11-16 05:46:45 -0500, Steve Holden <[EMAIL PROTECTED]> said:
>>
>>> James Cunningham wrote:
>>>> On 2006-11-15 20:59:26 -0500, "wa
On 2006-11-16 12:46:05 -0500, "walterbyrd" <[EMAIL PROTECTED]> said:
>
> James Cunningham wrote:
>
>> Nope. It disproves your assertion that "certainly all of the lower
>> priced hosters" use Apache 1.3.
>
> Okay, where can I get Python
is 'myjpegs'):
import binascii
import myjpegs
import cStringIO
def get_jpeg_as_opened_file(jpegname, module):
jpegascii = module.__dict__[jpegname]
jpegbin = binascii.a2b_base64(jpegascii)
return cStringIO.StringIO(jpegbin)
# getting that pik
get_jpeg_as_opened_file('coo
(tk, text='button')
py> b.tk
py> b.tk.call
> I have tried the following:
>
> self.table.bind("",self.table.tk.call(self.table._w,'yview','scroll',-5,'units')
I haven't used Table, but are you sure that what you are calling
&q
come from a java background, and that seems
> the only language I can pay the bills with:). Particularly in the US
> paid python jobs are hard to come by.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstrou
A.M wrote:
> Hi,
>
> Is there any built in feature in Python that can format long integer
> 123456789 to 12,3456,789 ?
>
> Thank you,
> Alan
I did this for putting commas into monetary amounts (thus the .2f):
def commas(value):
return "".join(commafy("%.2f" % value))
def commafy(s):
e it.
>
> Micah
>
Try urllib.
py> import urllib
py> astr = 'faf\tfasf dsf\ndsfds dsf dsaf \t\r'
py> urllib.quote(astr)
'faf%09fasf%20dsf%0Adsfds%20dsf%20dsaf%20%09%0D'
py> print astr
faf fasf dsf
dsfds dsf dsaf
James
--
James Stroud
UCLA-DOE
rom Tkinter import *
root = Tk()
def callback(e=None):
t = Toplevel()
Label(t, text='blah').pack()
b = Button(root, text='new top', command=callback)
b.pack()
root.mainloop()
Also, do not do this twice in the same script: Tk().
James
--
James Stroud
UCLA-DOE Institute
> windows. I have looked into the "takefocus" option, but doesn't seem
> to have any effect.
>
> I'm using Python 2.4 on Windows XP Pro SP1.
>
>
> Thanks
> Bernard
You should post a code snippet so we can see if there is anything amiss.
James
--
Jame
> appears 4/4.
>
> maybe have you some suggestions or idioms where i should look after
>
> best.
>
Look into suffix trees.
http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Tree/Suffix/
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
27;d']
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield char + char2 + char3
>
> x = generate()
> x.next() # etc, etc, etc,
>
import string
alpha = string.lowercase
def generator(choices, length):
fo
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield char + char2 + char3
>
> x = generate()
> x.next() # etc, etc, etc,
>
A touch more efficient:
import string
alpha = string.lowercase
def generator(c
7;]
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield char + char2 + char3
>
> x = generate()
> x.next() # etc, etc, etc,
>
Yet a little more efficient.
import string
alpha = string.lowercase
def gener
esn't do so well for something like
aaa
aab
.
.
.
zzy
zzzzzzz
James
SuperHik wrote:
> James Stroud wrote:
>
>> SuperHik wrote:
>>
>>> and the winner is... :D
>>> David Isaac wrote:
>>>
>>>> alpha = string.lowercase
>>>> x=(a+b+c for a in alpha for b in alpha for c in alpha)
>>>
>
Steve Holden wrote:
> James Stroud wrote:
>
>> Rob Cowie wrote:
>>
>>> Hi all,
>>>
>>> I wish to generate a sequence of the form 'aaa', 'aab', aac' 'aba',
>>> 'abb', 'abc' etc. all
Steve Holden wrote:
> James Stroud wrote:
>
>> SuperHik wrote:
>>
>>> and the winner is... :D
>>> David Isaac wrote:
>>>
>>>
>>>> alpha = string.lowercase
>>>> x=(a+b+c for a in alpha for b in alpha for c in alpha)
&
James Stroud wrote:
> SuperHik wrote:
>
>> James Stroud wrote:
>>
>>> SuperHik wrote:
>>>
>>>> and the winner is... :D
>>>> David Isaac wrote:
>>>>
>>>>> alpha = string.lowercase
>>>>> x=(a+b+
Steve Holden wrote:
> James Stroud wrote:
>
>> SuperHik wrote:
>>
>>> and the winner is... :D
>>> David Isaac wrote:
>>>
>>>
>>>> alpha = string.lowercase
>>>> x=(a+b+c for a in alpha for b in alpha for c in alpha)
&
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> See the actual question:
>>
>> >How would you construct a generator to acheive this?
>
>
> if you don't think the context provided by the subject line and the
> sentence before the question is impo
ient and which aren't?
>
> Thanks in advance,
> Ben
>
As an experiment, I googled 'python idioms' and got a few good hits
right at the top. I probably should have done this a long time ago.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Bo
in relation to tuples at all, do they?
>
Aside from grouping, they are special to construct an empty tuple.
py> () == tuple()
True
Also, don't underestimate their relationship with tuples when it comes
to grouping:
py> a, b, c = 1, 2, 3
py>
py> a == a, b, c
(True, 2, 3)
py&g
ly your question (which you
didn't really have). I'm sure I will regret this becuase, as you will
find, suggesting code on this list with additional utility is somewhat
discouraged by the vociferous few who make a religion out of 'import this'.
Also, I still have no idea what 'groupby' does. It looks interesting
thgough, thanks for pointing it out.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> Frank Millman wrote:
>
>> Hi all
>>
>> This is probably old hat to most of you, but for me it was a
>> revelation, so I thought I would share it in case someone has a similar
>> requirement.
>>
>> I had to convert an ol
Alex Martelli wrote:
> James Stroud <[EMAIL PROTECTED]> wrote:
>...
>
>>def doit(rows, doers, i=0):
>> for r, alist in groupby(rows, itemgetter(i)):
>> if len(doers) > 1:
>> doit(alist, doers[1:], i+1)
>> doers[0](r)
>
>
Alex Martelli wrote:
> James Stroud <[EMAIL PROTECTED]> wrote:
>...
>
>>def doit(rows, doers, i=0):
>> for r, alist in groupby(rows, itemgetter(i)):
>> if len(doers) > 1:
>> doit(alist, doers[1:], i+1)
>> doers[0](r)
>
>
7', 16)
>
> 231
> ---
>
> Does anyone have a clue a to what I need to do?
>
> Thanks!
>
> Andreas Lydersen
>
py> t = lambda x: int(x, 16) - ((int(x, 16) >> 7) * 256)
py> t('e7')
-25
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
e fun kind of memory) and all of those mind boggling
keystrokes begin to feel like an artistic expression reminiscent of
playing the piano.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
108, 111, 44, 32, 119, 111, 114, 108, 100, 33]
>
> print filter(lambda n: n % 2 == 0, numbers)
>
>
>
> numbers = [72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33]
>
> print reduce(lambda x, y: x+y, numbers)
>
>
>
> Thank you,
>
> Alan
ue...maybe personality #2 should be
> arguing for brown instead).
>
> My best friend is an emacs user, and I'm a vimmer...it doesn't
> come between us. :)
>
> -tkc
Yes, heartwarming, but if you are thinking marriage...
--
James Stroud
UCLA-DOE Institute for G
)
> ECB cipher. Why we have this limitation?
>
> Laszlo
>
>
CBC mode is cipher block chaining, so it still works as a block cipher,
which means that it must be that len(text) % block_size == 0. In other
words, CBC does not shift by one byte but by block_size bytes. See:
http://e
common task and I don't want to re-invent the
> wheel.
>
> Ryan
Most people probably use something like vim rather than re-inventing the
wheel themselves.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud
s. I'm not so sure C is better suited.
Definitely resist "shell scripting". Several chapters in Mark Lutz's
_Programming Python_ will help with networking (after you have read
through _Learning Python_ or equivalent). NewRiders publishes _Python
Web Programming_ authored by Ste
>
This problem seems to be beyond the code you provide. Is this part of a
larger program? Is it possible to show the entire script?
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
7;.join(t))
> return l
>
> This gives me a syntax error!
> I need to output a list that has all the permutations of the input string.
>
>
>
>
>>--
>>http://mail.python.org/mailman/listinfo/python-list
>>
>
>
p = ["".join(s) for s in permute('abcdefg')]
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
ows:
>
> def permute(seq):
> l = []
> if len(seq) == 0:
> yield []
> else:
> for i in range(0,len(seq)):
> for rest in permute(seq[:i] + seq[i+1:]):
> yield (seq[i],) + rest
>
> def main(stringList):
>
Dan Sommers wrote:
> On Sun, 25 Jun 2006 21:10:31 +0100,
> Andrew McLean <[EMAIL PROTECTED]> wrote:
>
>
>>I'm looking at putting some e-mail contact addresses on a web site,
>>and wanted to make it difficult for spammers to harvest them.
>
>
> [ ... ]
>
>
>>Searching the web it looks like the
blue=yes&local_file_name=%(OUT_FILE_NAME)s&show_instructions=no&expt_link=NASCArrays&max_adjust=2&view_size=large&highlight=%(HI_LITE_FILE_NAME)s">GraphicalOutput
>
>
> ''' % {'OUT_FILE_NAME': OUT_FILE_NAME, 'HI_
;===
You have assigned open (which, by the way, is a builtin!) in a function
*after* you have referenced it. You have over-ridden the open name with
the assignment, but you have referenced it 'before assignment', as your
error mesage says. This is a favorite trip-up of newer pytho
+2)
149679044
py> id(7*6)
149679044
So, I guess my question is to what extent is this equivalency
implementation dependent? Is this equivalency a requirement for a
legitimate python implementation? Won't these checks slow down
evaluation of 'is' considerably? Does '==
lHello = Label(F, text="Hello")
> lHello.pack()
> bQuit = Button(F, text="Quit", command=F.quit)
> bQuit.pack()
> # set the loop running
> top.mainloop()
>
This gets pretty close:
top.geometry('%sx%s+0+0' % top.maxsize())
James
--
James Stroud
U
t
decorators as they seem like they could be used for this, but I've no
idea how exactly, or even if they're the appropriate tool.
Thanks.
--
James Mitchelhill
[EMAIL PROTECTED]
http://disorderfeed.net
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 4 Jul 2006 16:53:27 -0700, Alex Martelli wrote:
> James Mitchelhill <[EMAIL PROTECTED]> wrote:
>> I'm trying to write a class that analyses some data. I only want it to
>> do as much work as necessary, so it saves method results to a
>> dictionary
&
[EMAIL PROTECTED] wrote:
> I would be interested in comments about how Common Lisp, Scheme, and
> Haskell deal with the decorate-sort-dedecorate technique.
%w(FORTRAN LISP COBOL).sort_by{|s| s.reverse}
==>["COBOL", "FORTRAN", "LISP"]
--
Common Lisp did kill Lisp. Period. ... It is to Lisp
t;Software Management", select the search filter, and enter python in
the search box.
There's a ton of Python stuff on SUSE, and there's even more in my
YaST-compatible repo at http://repos.opensuse.org/home:/jimfunk/ .
--
James Oakley
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
oriented web development
with a focus on applying my python skills.
Any suggestions will be greatly appreciated.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
ho', 'art', 'in', 'heaven', 'hallowed', 'be', 'their', 'names', 'did',
'forthwith', 'declare', 'that', 'all', 'men', 'are', 'created', 'to
n
Eddy and colleagues:
http://hmmer.janelia.org/
http://selab.janelia.org/people/eddys/
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
#x27;(?:c|n)(?:p|s)(?:k|u|d)g-3(?:1|0)0(?:A|0)(?:A|B|1|0|3|2|6|8)'
print rgx_str
But, if you get much more complicated that this, you will definitely
want to check out hmmer, especially if you can align your sequences.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
27; object has no attribute 'group'
py> patt_3plus.search(s1).group(0)
Traceback (most recent call last):
File "", line 1, in ?
AttributeError: 'NoneType' object has no attribute 'group'
py> patt_2plus.search(s1).group(0)
Traceback (most recent call la
ing one of the most accessible modules (to me, anyways)--and well
worth learning.
However, in complicated applications, regex is usually still fun and
valuable as an intellectual exercise.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
he columns. Zeros will
indicate high probability of between-column. Code tomorrow if no one
else posts.
Must run...
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
if v is not isit:
indices.append(i)
isit = not isit
indices.append(i+1)
indices = [t for t in zip(indices[::2],indices[1::2])]
columns = [[line[t[0]:t[1]].strip() for line in lines] for t in indices]
In case you want rows:
rows = zip(*columns)
James
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> indices = [t for t in zip(indices[::2],indices[1::2])]
(Artefact of cut-and-paste.)
Make that:
indices = zip(indices[::2],indices[1::2])
James
--
http://mail.python.org/mailman/listinfo/python-list
;, x
return highliter
class Test:
def __init__(self, parent):
buttons = [tk.Button(parent, text=str(x+1),
command=make_it(x)) for x in range(5)]
for button in buttons:
button.pack(side=tk.LEFT)
root = tk.Tk()
d = Test(root)
root.mainloop()
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
Simon Burton wrote:
>>>>class A(object):
>
> ... def foo(self): pass
> ...
>
>>>>class B(A):
>
> ... pass
> ...
>
>>>>b=B()
>>>>b.foo
>
> >
>
> How can I work out what class b.foo was defined in
k this is, but I would do it thus:
dicts = [{'column':1}, {'column':2}, {'column': 4}, {'column': 8},
{'column':4}]
vals = list(set(d['column'] for d in dicts))
vals.sort()
amap = dict((b,a) for (a,b) in enumerate(vals))
for d in dic
is this possible?
>
Depends on your namespace, but for the local namespace, you can use this:
py> a = object()
py> a
py> locals()['bob'] = a
py> bob
A similar approach can be used for the global namespace.
James
--
James Stroud
UCLA-DOE Institute for Genomics
uot;?".join([baseurl, fetchparams]))
afile = open(filename, "w")
afile.write(wwwf.read())
afile.close()
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
an artefact
of the CPython implementation?
James
--
http://mail.python.org/mailman/listinfo/python-list
Everyone wrote:
> [something intelligent]
Ah, clarity. My confusion can undoubtedly be traced to a non-existent
formal training in computer programming.
Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
e file object, so this won't work; you have to
> bind the file to a temporary variable to be able to close it.
Strictly speaking, "have to" is not perfectly correct. The ".close()"
part can simply be eliminated as the file should close via garbage
collection once leaving the local namespace.
James
--
http://mail.python.org/mailman/listinfo/python-list
r its good code from others. Names have been changed to
protect the innocent.
James
#! /usr/bin/env python
import sys
import os.path
import time
import random
import urllib
import urllib2
import cookielib
class DummyError(Exception): pass
yxh wrote:
> how to use timer in python.
> the functionnality is like the MFC SetTimer()
>
>
Try this (a little more flexible than Timer):
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/464959
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los
;red")
# note change here
self.button["command"] = functools.partial(self.getPath, t)
self.button.pack(side=LEFT)
def getPath(self, t):
dirPath = tkFileDialog.askdirectory(initialdir="c:\\")
print dirPath
t.set(dirPath)
root = Tk()
app = App(root)
root.mainloop()
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
e special in this regard?
I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry
libraries in non-standard places. Is this non-standard part what's
killing me?
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jam
James Stroud wrote:
> Hello All,
>
> This is annoying. I am trying to build scipy right now but every .so
> file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
> to the ld flags.
>
> Main Question: When building with "setup.py", whe
Robert Kern wrote:
> James Stroud wrote:
>
>> Hello All,
>>
>> This is annoying. I am trying to build scipy right now but every .so
>> file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl
>> -shared" to the ld flags.
>
>
>>
Robert Kern wrote:
> James Stroud wrote:
>> I did build my own python 2.5, yesterday, requiring me to rebuild all
>> extensions.
>
> Do other extensions build correctly? If so, it's beginning to look like
> a problem in numpy.distutils .
It seems that every thi
Martin v. Löwis wrote:
> James Stroud schrieb:
>> This is annoying. I am trying to build scipy right now but every .so
>> file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
>> to the ld flags.
>
> That shouldn't be necessary.
1101 - 1200 of 3434 matches
Mail list logo