Joseph Garvin <[EMAIL PROTECTED]> writes:
> I'm curious -- what is everyone's favorite trick from a non-python
> language?
Metapost solution of linear equations:
x1+9=x2-8=2;
> And -- why isn't it in Python?
I'd like to know too.
--
Bri
is the best 3d-lib for that, afaik.
The good thing is that you get plot that work in both latex and
pdflatex and integrates completely with latex text.
--
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
--
http://mail.python.org/mailman/listinfo/python-list
e first problem here:
http://www.sweetapp.com/pycontest/contest1
I'm always looking for feedback, so let me know what you think or if you
have any ideas for future problems.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
Module loading is done before
the test is run. Also, it is easiest to protect my system against
malicious code if it is being run on an OS without a writeable filesystem.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Brian> I've decided that it would be be fun to host a weekly Python
> Brian> programming contest. The focus will be on algorithms that require
> Brian> a bit of thought to design but not much code to implement.
>
> For some o
Bill Mill wrote:
> On 7/15/05, Brian Quinlan <[EMAIL PROTECTED]> wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>Brian> I've decided that it would be be fun to host a weekly Python
>>>Brian> programming contest. The focus will be on algo
[EMAIL PROTECTED] wrote:
> Brian> This contest is for people who like thinking about algorithms.
>
> Surely you must have missed the smiley...
No, I saw it but it just confused me as I have no sense of humor.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
which is preferred?
The first option (day 3 for 390 units).
> P.S. I just realized this may be answered be the test suite, but I'm
> still at the thinking stage.
No problem. Let me know if you have any other questions.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
t; What would the solution be? And for how much in total?
There are two correct solutions:
["A", "B"] # spend one night in A, then fly to B on day two (cost 80)
["A", "A", "B"] # spend two nights in A, then fly to B on day two
(cost 80)
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
would be, I fly from A to B for 40 bucks on day 3,
> assuming I live in the current city A.
Then you should assume that you don't live in city A, because the actual
cost in this case is 80.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
ution of the random
schedule so as not to be biased against some solutions.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
resource for people
looking for best practice examples and also for people looking for
performance ideas.
You can find the first problem here:
http://www.sweetapp.com/pycontest/contest1
I'm always looking for feedback, so let me know what you think or if you
have any ideas for future problems.
Subscribe
Thanks,
Brian Lee
--
http://mail.python.org/mailman/listinfo/python-list
ar"
py> s[:3]
'foo'
py> s[:3] + "B" + s[4:]
'fooBar'
py>
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
Ivan Van Laningham wrote:
> I like / as a shortcut to joinwith(). I like it a lot. I like it so
> much I'll give you a +2.
+1 here. Extremely practical.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
in less than 3 hours after the contest was
announced. That's impresive for a correct solution.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
#x27;s __mro__ solution returns the bases in reverse
order than what you requested (in your example, you said B should come
last). So use list(reversed(z.__class__.__mro__)) or
z.__class__.__mro__[::-1]
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
siblings of X and B (subpaths of B and A).
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
get Zope up
and running before you can use Plone. See www.zope.org. There are also
specific mailing lists (on Gmane, www.gmane.org) dedicated to Zope,
Plone, and their related packages.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
David Blomstrom wrote:
> This is my first post on this list, and I'm new to
> Python.
Oh, and I forgot to mention: welcome to Python and our community!
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
te. I'll do it tomorrow.
> Where do the timing results come from? Is it the number that
> fly_test.main(['fly']) outputs? I don't think it is that because with my
> solution that would be ~0.06 seconds.
This is the time required to do several thousand trials.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
Brian Quinlan wrote:
> Tomi Kyöstilä wrote:
>
>Why don't I see my solution (__author__ = "dOb") in the results? I'm
>sure that you got it as you replied to my mail.
Your solution is now included. See:
http://www.sweetapp.com/pycontest/contest1/results.html
G
Tomi Kyöstilä wrote:
> Any idea when the next competition is coming? (it hasn't been quite
> weekly as you hoped, eh? ;)
Uh no. It turns out that I have less time than I thought, though a big
chunk of it should be freed-up after this weekend. I do have an idea... :-)
Cheers,
Bri
here is such a huge counter-example of "the best
technology wins" staring everyone in the face every day, that the first
part of your post doesn't really do anything for me.
But ultimately I am on your side. Python has a long way to go, and it
has nothing to do with the language
tion that operates on the
> "collection of all instances" rather than a single instance.
Really? What instances do the static methods in the Java Math class
operate on? Not Math instances, of course. So what is the rational for
them being packaged in the Math class?
Cheers,
Brian
--
h
...']
>>> s.get_my_board(token) # blocks until other guy shoots
['...pppa...',
'..a...',
'.da...',
'.dA.ss', # uppercase if hit
'.da...'])
Just designed in 2 minutes - but you get the idea.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
when I have never found that to be the case.
--
Brian
--
http://mail.python.org/mailman/listinfo/python-list
what you want:
vehicles = ("airplane", "car", "boat")
select = vars
while select not in vehicles:
select=raw_input("Wich vehicle?")
--
Brian
--
http://mail.python.org/mailman/listinfo/python-list
Paul Lalli wrote:
>
> m//;
>
> it matches everything.
Not in Perl it doesn't. :-)
--
http://mail.python.org/mailman/listinfo/python-list
> I know this is entirely inappropriate and OT, [...]
Yeah -- unlike the rest of this misbegotten thread, which is right
bang on-topic for all five newsgroups and is not suffering at all from
topic drift, no not in the least.
b
--
http://mail.python.org/mailman/listinfo/python-list
> only one being exported. How can I register all the classes? Thanks.
class MyCombinedClass(MyClass1, MyClass2, MyClass3):
pass
Server.register_instance(MyCombinedClass())
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
it (possible race condition)
o the system doesn't have sufficient resources to open the file
e.g. too many open file handles
o the file is already open with exclusive read/write permission
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
to debug.
If you look at the Python C source, you'll notice that probably 50% of
the code is devoted to error handling (that was a guess).
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
Title: Message
If I set up a menu
item to Exit and use root.quit the application quits but I get a thread
terminated abnormaly error.
BTW I'm using Pmw to
create the menu and items.
primary email: [EMAIL PROTECTED]blog: http://briancolferblog.blogspot.com/M
at it is a for-all symbol in big-endian format?
For more details, see:
http://www.unicode.org/faq/utf_bom.html#BOM
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
S}r'
... .encode('utf-8').decode('latin1').encode('latin1')
'T\xc3\xbcr'
I can assume you that most Germans can differentiate between "Tür" and
"Tã¼r".
Using a BOM with UTF-8 makes it easy to indentify it as such AND it
shouldn
ot;File not found: %s" % fileName
# To close optionalFiles...
for fileName, fileObject in optionalFiles.iteritems():
if fileObject:
fileObject.close()
print "Closed: %s" % fileName
# Rebinding fileObject here won't modify the dictionary,
son actually using it. So string substitution makes it more
flexible; less work for them.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
(x) is True for every element in the iterable"
for elem in ifilterfalse(pred, seq):
return False
return True
def any(seq, pred=bool):
"Returns True if pred(x) is True for at least one element in the
iterable"
for elem in ifilter(pred, seq):
return True
Brian Beck wrote:
def all(seq, pred=bool):
"Returns True if pred(x) is True for every element in the iterable"
for elem in ifilterfalse(pred, seq):
return False
return True
def any(seq, pred=bool):
"Returns True if pred(x) is True for at least one element i
r x in ['a', '', 'b', 'c']))
False
py> bool(min(bool(x) for x in ['a', 'b', 'c', 'd']))
True
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
onsidering I have to do stuff like this on a daily basis!
Ignore mine except as a novelty, then.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
nd don't require the setup of a try/except/else.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
development work to enhance the standard Python
distribution IS volunteering.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
t wizardly enough to comment on.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
mjs7231 wrote:
This is no good, I am looking for milliseconds, not seconds.. as stated
above.
That IS what you want.
seconds * 100 = milliseconds
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
Brian Beck wrote:
That IS what you want.
seconds * 100 = milliseconds
are you sure you know what a millisecond is?
(duck)
Touché.
But it was a typo.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
he does have to *multiply* by a
thousand to get the number of milliseconds.
2 seconds * 1000 = 2000 milliseconds
So, aside from the 100 in the original post, it may look misleading, but
that is what he would need to do...
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/
Martin Christensen wrote:
A math teacher! A math teacher! My kingdom for a math teacher!
Martin
Man, this is the hottest topic on c.l.py since that Lazaridis guy...
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
x27;word' totalled over all selected dicts doesn't exceed a given
MAX_VALUE. Right now, I do this by:
Not that you can't still improve performance of course, but this is an
NP-complete problem if you didn't know, so don't bang your head too hard...
--
Brian
um problem.'
http://en.wikipedia.org/wiki/Subset_sum_problem
http://en.wikipedia.org/wiki/Knapsack_problem
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
pairs:
p = set(pairings.pop())
remove = set([])
for pair in pairs:
pairSet = set(pair)
if pairSet & p:
p |= pairSet
remove.add(pair)
pairs -= remove
merged.append(list(p))
return merged
--
Brian
Brian Beck wrote:
> [code]
Whoops, that should say:
def merge(pairs):
pairs = set(tuple(sorted(p)) for p in pairs)
merged = []
# Each loop will result in a new, complete sublist in the result.
while pairs:
p = set(pairs.pop())
remove = set([])
for pair
Brian Beck wrote:
Brian Beck wrote:
> [code]
Ah heck, nevermind... it worked for my small test cases but the
algorithm is just wrong.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
removePairs.add(pair) # Mark pair for removal
if removePairs:
pairList -= removePairs
else:
merged.append(list(subList))
return merged
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
) for s in sets if s]
# Comparison
import profile
import random
# Play with these values
xMax, nPairs = 1000, 5000
l = [[random.randint(0, xMax), random.randint(0, xMax)] for i in
range(nPairs)]
print 'merge2:'
profile.run('merge2(l)') # Mine
print 'merge:'
profile.ru
ant; and that's not
necessarily a good thing. Vampire points you in a nice direction (I
don't want to say 'the right' direction).
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
Maybe this can help you get it working on OS X:
http://thread.gmane.org/gmane.comp.python.mod-python/4039
But as stated in my other post, you may want to take a look at your
other options first. Web development with Python is really nothing like
PHP, unless you really want it to be.
--
Brian
should result in
the number unchanged. As his tests show, this is not the case. This is
because the operation works only if the least significant bit actually
NEEDS to be unset. To zero the least significant bit unconditionally, we
can use:
x &= ~1
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
ndow
to match the sizer's minimal size." Take this call out and the size
should be as you expect.
--
Brian
--
http://mail.python.org/mailman/listinfo/python-list
something resembling:
LoadModule python_module modules/mod_python.so
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
oid them if possible.
Or is there a better/different way of doing this? Any general advice
or pointers to some code that already does this would be very much
appreciated.
Python 2.3, under both Linux & Windows if that makes a difference.
Thanks,
Brian.
--
http://mail.python.org/mailman/listinfo/python-list
do
> this)
>
> Then I need a script that puts the events from the db into the calendar, if
> every day in the calendar has a value id that part will not be hard.
All this and more (perhaps overkill):
http://www.schooltool.org/schoolbell
--
Brian Sutherland
It's 10 minutes,
said it is buggy (lots of work arounds)?
Others ???
You could try Pyana (pyana.sourceforge.net). It's a binding to the
Apache Group's Xalan engine. I don't think that it is a flexable as
4Suite but it is probably faster and more standards compliant (it was
the last time that I c
he problem
youself.
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
ry different than,
say, C or C++, which has separate include and execute steps.
In general, you want to either use the built-in lists and dicts, or
create classes/objects to represent hundreds of things.
Brian.
--
http://mail.python.org/mailman/listinfo/python-list
need to call parseSource when the XML is different for each iteration,
that solves my problem, but the parseSoruce function should free all memory
anyways.
Yes it should. It's not obvious to me why it doesn't. I'll investage it
in detail a bit later.
Cheers,
Brian
--
http://mai
erent mathematical rules. Does anyone have a
better idea than parsing to compute an equation from a string
representation?
Thanks so much!
Brian Kazian
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the help, I didn't even think of that.
I'm guessing there's no easy way to handle exponents or logarithmic
functions? I will be running into these two types as well.
"Artie Gold" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Brian
Wow, thanks so much guys!
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Brian Kazian wrote:
>> Thanks for the help, I didn't even think of that.
>>
>> I'm guessing there's no easy way to handle exponents o
Xah Lee wrote:
i don't know what's the state of Perl's unicode.
perldoc perlunicode
--
http://mail.python.org/mailman/listinfo/python-list
to change precedence or to clear search term
ambiguity. These are likewise completely ignored.
;)
Have a helpful day.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
code('utf-7')
'+AP8-'
Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
ve it? Thanks!
I have the exact same problem. The IDLE window just never opens, and
checking the process list shows that is was never even launched. So I
can't make much use of Python 2.4 since I use IDLE as my IDE...
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.o
Brian Beck wrote:
I have the exact same problem. The IDLE window just never opens, and
checking the process list shows that is was never even launched. So I
can't make much use of Python 2.4 since I use IDLE as my IDE...
I forgot to note that I am also using Windows XP SP2 and this happe
o remember seeing that message but thought "no way" since the Windows
firewall is pretty forgiving in my experience. But after a bit of
tweaking and even disabling the firewall completely, the problem persists.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mai
erstand is why mastervar gets modified by each _seperate
instance_ of classes that happen to extend the base class 'a'.
Shouldn't mastervar be contained within the scope of the inheriting
classes? Why is it being treated like a global variable and being
modified by the other ins
out.
The amount of text in the library manual is huge (it requires two
volumes), which makes it more costly.
--
best regards,
Brian Gough
Network Theory Ltd,
Publishing the Python Manuals --- http://www.network-theory.co.uk/python/
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
I need to map a function to several variables. I'm trying to use map
and lambda to do this. Here's my attempt...
#!/usr/bin/env python
from random import *
[fee, fye, foe, fum] = map(lambda n: random(), range(4))
from random import random
fee = random()
fye = random()
foe
thon/language/ - language reference
http://www.network-theory.co.uk/about.html - general company info
--
best regards
Brian Gough
Network Theory Ltd,
Publishing the Python Manuals --- http://www.network-theory.co.uk/python/
--
http://mail.python.org/mailman/listinfo/python-list
cwru.edu/python2.png
If anyone can think of a way to break free of the reptile-oriented
thought process but maintain clear, symbolic imagery, I'd love to see
more suggestions or renditions!
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
;s a syntax to tell the Python interpreter which
characters in your string are 'special' and has no effect on strings not
input as literals directly within your code. Strings from files or any
input besides the interactive Python shell will already be what you're
looking for.
st method can only be
determined if you know how many times it has already been called)
Is this behaviour what you would (should?) intuitively expect?
Thanks,
Brian
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, this makes perfect sense. The phrase which sums it up neatly is
"Default parameter values are evaluated when the function definition is
executed"
However, is there a good reason why default parameters aren't evaluated
as the function is called? (apart from efficiency and backwards
compatib
def function(arg=otherfunction(value)):
return arg
My expectation would have been that otherfunction(value) would be
called if (and only if) the arg keyword parameter was missing from the
function() call (ie. the optional value is evaluated the lazy way).
Also, otherfunction would be called each a
={})
How could I re-write this (especially if there are perhaps 20 optional
parameters,any number of which may have mutable defaults) without
writing 20 "if opt1 is None: opt1=[]" statements?
Brian
--
http://mail.python.org/mailman/listinfo/python-list
bers, same ranking.
Good analogy.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
It's me wrote:
How do I know if arg1 is a single type (like a number), or a list?
isinstance is probably good enough for your needs.
if isinstance(arg1, (list, tuple, dict)):
print "arg1 is a container"
else:
print "arg1 is (probably) not a container"
--
Brian Bec
t;
and {}'s are clearly already used for dictionaries.
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
ith an attrgetter, but apparently my
understanding of that isn't perfect... it groups by the identify of the
bound method instead of calling it...
--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list
nt
Everything works fine until I get to r.snippet. Here is the error:
UnicodeEncodeError: 'ascii' codec can't encode character '\ua9' in
position 119: ordinal not in range(128)
Any help is appreciated.
Thanks,
Brian
--
Nail a post to the Spalted Board. Fr
On 2005-04-05 07:32:12 -0500, "Richard Brodie" <[EMAIL PROTECTED]> said:
"Brian Blazer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Everything works fine until I get to r.snippet. Here is the error:
UnicodeEncodeError: 'ascii' codec can
On 2005-04-04 10:06:23 -0500, Brian Blazer <[EMAIL PROTECTED]> said:
You know, I am beginning to think that I MAY have stumbled on a bug
here. At first I was thinking that this issue was related to the
offending character being out of range for the Mac. Then I tried it on
A MS machine
On 2005-04-05 13:55:48 -0500, Erik Max Francis <[EMAIL PROTECTED]> said:
Thank you, that worked.
Brian
--
Nail a post to the Spalted Board. Free WW'ing software and forums.
Regular freebies! http://www.spaltedboard.com
--
http://mail.python.org/mailman/listinfo/python-list
I want to insure that all subclasses implement a certain method, but could
not find anything that would do this for me. Is there anyway in Python to
implement this check? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Active State's Komodo IDE is very nice for python development. It
includes integration with pdb (python's debugger). The pro edition
also has a GUI designer, however I've never used it. The personal
version for non commercial use can be had for $30 (and there's also a
30 day trial). They have w
Here is a first draft of a PEP for thunks. Please let me know what you
think. If there is a positive response, I will create a real PEP.
I made a patch that implements thunks as described here. It is available
at:
http://staff.washington.edu/sabbey/py_do
Good background on thunks can be fo
Here is a pre-PEP for what I call "suite-based keyword arguments". The
mechanism described here is intended to act as a complement to thunks.
Please let me know what you think.
Suite-Based Keyword Arguments
-
Passing complicated arguments to functions is currently awk
Shane Hathaway wrote:
Kent Johnson wrote:
Brian Sabbey wrote:
Using suite-based keyword arguments, the code
f(x = 1)
is equivalent to
f():
x = 1
ISTM the syntax is ambiguous. How do you interpret
if f():
x = 1
?
Is a suite alllowed only when a block could not be introduced in the
current
Reinhold Birkenfeld wrote:
Brian Sabbey wrote:
Here is a pre-PEP for what I call "suite-based keyword arguments". The
mechanism described here is intended to act as a complement to thunks.
Please let me know what you think.
Suite-Based Keyword Arguments
---
201 - 300 of 1138 matches
Mail list logo