Duncan Booth <[EMAIL PROTECTED]> wrote:
> Ben Finney wrote:
> > What is the common idiom here? I can conceive of several possible
> > ways to get around it, all of which seem hackish to some degree.
>
> I don't know if it is the common idiom, but I tend to write
>> acc.flush()
Flushing items: ['strawberry']
>>>
--
\ "[W]e are still the first generation of users, and for all that |
`\ we may have invented the net, we still don't really get it." |
_o__) -- Douglas Adams |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
When I read python Manuel, I got confused by the following code:
def turnRed(self, event):
event.widget["activeforeground"] = "red"
self.button.bind("", self.turnRed)
I can not understand it.
--
http://mail.python.org/mailman/listinfo/python-list
I tested the following code and wanted to get the message of "oval2
got hit" if I click the red one. But I always got "oval1 got hit".
from Tkinter import *
root=Tk()
canvas=Canvas(root,width=100,height=100)
canvas.pack()
a=canvas.create_oval(10,10,20,20,tags='oval1',fill='blue')
b=canvas.create_ov
On 12/4/05, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> Ben Bush wrote:
> > I tested the following code and wanted to get the message of "oval2
> > got hit" if I click the red one. But I always got "oval1 got hit".
> > from Tkinter import *
> &
'd take it on you to consult the documentation as I asked you
> to do, I'm pretty sure you find the proper attribute.
>
>
> Regards,
>
> Diez
> --
> http://mail.python.org/mailman/listinfo/python-list
>
thanks anyway. The python manual for event is very brief and it is
hard for me to understand.
--
Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
On 12/4/05, Peter Otten <[EMAIL PROTECTED]> wrote:
> Ben Bush wrote:
>
> > On 12/4/05, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> >> Ben Bush wrote:
> >> > I tested the following code and wanted to get the message of "oval2
> >> > go
I tested the following code and wanted to make oval 2 become red after
I hit the enter key but though the code did not report error, it did
not change.
from Tkinter import *
root=Tk()
canvas=Canvas(root,width=100,height=100)
canvas.pack()
canvas.create_oval(10,10,20,20,tags='oval1',fill='blue')
can
term can see benefits to the
approach when it is not just mentioned as a bizarre and arbitrary
limitation of the language.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
sEqual(score, instance.get_score())
self.iterate_test(test_func)
That's somewhat clearer; the test function actually focuses on what
it's testing. Those layers of indirection are annoying, but they allow
the data sets to grow without writing more code to handle them.
Testing a rules-based system involves lots of data sets, and each data
set represents a separate test case; but the code for each of those
test cases is mindlessly repetitive. Factoring them out seems like it
needs a lot of indirection, and seems to make each test harder to
read. Different *types* of tests would need multiple iterators, more
complex test parameter dicts, or some more indirection. Those all
sound ugly, but so does repetitively coding every test function
whenever some new data needs to be tested.
How should this be resolved?
--
\ "I never forget a face, but in your case I'll be glad to make |
`\ an exception." -- Groucho Marx |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
"I put instant coffee in a microwave oven and almost went back |
`\ in time." -- Steven Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels <[EMAIL PROTECTED]> wrote:
> Ben Finney wrote:
> > Summary: I'm looking for idioms in unit tests for factoring out
> > repetitive iteration over test data
>
> How about something like:
>
> > class Test_Game(unittest.TestCase):
my job the other day. They said my |
`\personality was weird. ... That's okay, I have four more." -- |
_o__)Bug-Eyed Earl, _Red Meat_ |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney <[EMAIL PROTECTED]> wrote:
> Summary: I'm looking for idioms in unit tests for factoring out
> repetitive iteration over test data.
Thanks to those who've offered suggestions, especially those who
suggested I look at generator functions. This leads to::
impor
e done before a tool becomes
useless.
The context of your quote is that that things should be
self-documenting and obvious.You simply can't do that with programming
languages. All you can do is try to make it as consistent as possible,
so that there are few surprises and as little documentatio
t up into separate manuals doesn't seem like it would help.
Personally I'd be happy to see a lot of those modules removed from the
distribution, but I expect few will agree with me. ;)
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
simply can't do that with programming languages.
>
> Maybe not completely. Trust me though, we can do better.
Of course. However I would argue that indented scope is one way of
doing so. Scope is instantly visible, and no longer a game of 'hunt the
punctuation character, which i
Antoon Pardon wrote:
> Op 2005-12-06, Ben Sizer schreef <[EMAIL PROTECTED]>:
> > Of course. However I would argue that indented scope is one way of
> > doing so. Scope is instantly visible, and no longer a game of 'hunt the
> > punctuation character, which is in a
does not appear on
the surface to come from a library.
As an aside, personally I rarely touch the sys module. I use re,
random, threading, and even xml.dom.minidom more than sys.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
tters.
--
\ "I don't know anything about music. In my line you don't have |
`\ to." -- Elvis Aaron Presley (1935-1977) |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
, just deliver the message.
--
\ "Those who can make you believe absurdities can make you commit |
`\ atrocities." -- Voltaire |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
e any other options that would require a minimum of
rewriting of code? Does anybody have any experience of such a project?
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
But you could use a dict of return values, or even just assigning a
different return value in each if clause. The end result is that you
have a single well-defined exit point from the function, which is
generally considered to be preferable.
--
http://mail.python.org/mailman/listinfo/python-list
|
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
Having recently upgraded to Python 2.4, I am having a large memory
leak with the following code built with VC++ 6.0:
PyObject *pName, *pModule;
Py_Initialize();
pName = PyString_FromString(argv[1]);
pModule = PyImport_Import(pName);
Peter Hansen <[EMAIL PROTECTED]> wrote:
> Ben Finney wrote:
> > Roy Smith <[EMAIL PROTECTED]> wrote:
> >>[current-directory module shadowing a system module]
> >
> > All hail the coming of PEP 328:
> > http://www.python.org/peps/pep-0328.ht
Aahz <[EMAIL PROTECTED]> wrote:
> Ben Finney <[EMAIL PROTECTED]> wrote:
> >So, under PEP 328 rules, the original poster's current-directory
> >module could only be imported (a) if the current directory was in
> >sys.path, or (b) if the code specified a relati
\ it, it said 'Day 1: Still tired from the move. Day 2: Everybody |
_o__) talks to me like I'm an idiot.'" -- Steven Wright |
Ben Finney <http://www.benfinney.id.au/>
--
http://mail.python.org/mailman/listinfo/python-list
and each
instance has its own 'bar' attribute created separately (in the
__init__() method).
--
\ "Unix is an operating system, OS/2 is half an operating system, |
`\ Windows is a shell, and DOS is a boot partition virus." -- |
_o__) Peter H. Coffin |
Ben Finney <http://www.benfinney.id.au/>
--
http://mail.python.org/mailman/listinfo/python-list
quot; -- Justice Roberts in 319 U.S. 624 (1943) |
_o__) |
Ben Finney <http://www.benfinney.id.au/>
--
http://mail.python.org/mailman/listinfo/python-list
ond-class citizen in the wx
world.
--
\ "I was the kid next door's imaginary friend." -- Emo Philips |
`\ |
_o__) |
Ben Finney <http://www.benfinney.id.au/>
--
http://mail.python.org/mailman/listinfo/python-list
://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/408713>
--
\ "Any sufficiently advanced bug is indistinguishable from a |
`\ feature." -- Rich Kulawiec |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
tacts, but I only need them when I read, so I got |
`\ flip-ups." -- Steven Wright |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
in Pything is more
> efficient. Please read the responses you've already gotten.
Grant,
Going by the Google Groups timestamps that I see, there's a good chance
that none of the other responses were visible to the OP when the above
followup was posted.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
-
\ "If trees could scream, would we be so cavalier about cutting |
`\ them down? We might, if they screamed all the time, for no good |
_o__) reason." -- Jack Handey |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list
I have a program that is developed in C, that has a simple text
interface. I would like to use the same program, but with a GUI. I
would like to use Python to interface with it, so that Python will
simply read and write the code that would be used from a normal user,
but using a TK GUI. For exa
different processing depending on which sentence type you have, then
yes, this class hierarchy may be useful to you.
--
Ben Sizer
--
http://mail.python.org/mailman/listinfo/python-list
alex wrote On 17/02/05 02:08:
how can I check if a variable is a structure (i.e. a list)? For my
special problem the variable is either a character string OR a list
of character strings line ['word1', 'word2',...]
You're trying to apply the LBYL principle. My bet is that your "special
problem" c
Hi -
This is the "vacation" program; I'm working for my owner, Ben. The account to
which you have sent your mail is going to be discontinued at at the end of July
(Yahoo's mail service has deteriorated well past "abysmal" into "nightmarishly
bad",
In emacs matlab-mode, highlight a region then use indent-region:
C-M-\ runs the command indent-region
which is an interactive compiled Lisp function in `indent'.
(indent-region START END COLUMN)
Indent each nonblank line in the region.
With prefix no argument, indent each line using `indent-acco
X use in Python doesn't seem to be done for some
reason.
--
Ben Sizer.
--
http://mail.python.org/mailman/listinfo/python-list
d across a lan of 4 windows computers.
I've dabbled with different languages over the years and i think
python is a good language for this but i have had a lot of trouble
sifting through manual and tutorials finding out with commands i need
and their syntax.
Can someone please help me?
Thanks
ead. If I comment out the threading code
and uncomment the line below "#WORKS", the button text
updates fine. But in the thread it breaks...
I feel like I'm being stupid here, so ANY suggestions are
much appreciated.
Thanks all.
Ben Floyd
[EMAIL PROTECTED]
#CUT
ine.
Interesting.
Where does it call home? site-packages?
-Ben
--
http://mail.python.org/mailman/listinfo/python-list
what I'm pondering?” “I think so, |
`\ Brain, but shouldn't the bat boy be wearing a cape?” —_Pinky |
_o__) and The Brain_ |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ith some good ideas.” —Jack Handey |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ge
http://pillow.readthedocs.org/en/latest/reference/Image.html>.
--
\ “It seems intuitively obvious to me, which means that it might |
`\ be wrong.” —Chris Torek |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Ben Finney writes:
> To turn a byte string into a file-like object for use with PIL, extract
> the byte string as ‘image_data’, use the standard library ‘io.StringIO’
> class http://docs.python.org/3/library/io.html#io.StringIO>, then
> create a new ‘PIL.Image’ object by reading f
ntaining a URL to an amusing Twitter post about
Python.
--
\ “True greatness is measured by how much freedom you give to |
`\ others, not by how much you can coerce others to do what you |
_o__) want.” —Larry Wall |
Ben
el.
Is there something particular about these functions that make them more
difficult than good code?
--
\ “Generally speaking, the errors in religion are dangerous; |
`\those in philosophy only ridiculous.” —David Hume, _A Treatise |
_o__)
r the long run on distinguishing one |
`\ bitstream from another in order to figure out which rules |
_o__) apply.” —Eben Moglen, _Anarchism Triumphant_, 1999 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
of Basic will ensure that no one ever uses it again.
True BASIC does not even have a Linux/Unix port.
Finally, why are you timing Perl arithmetic? A translation into Perl
does not seem to be an option.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
ure.
--
\ “The trouble with the world is that the stupid are cocksure and |
`\ the intelligent are full of doubt.” —Bertrand Russell |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
, but how does it work in |
`\ *theory*?” —anonymous |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
rk?
--
\“Program testing can be a very effective way to show the |
`\presence of bugs, but is hopelessly inadequate for showing |
_o__) their absence.” —Edsger W. Dijkstra |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
and/or convince your system
administrators to remove it when sending to public forums.
--
\“… Nature … is seen to do all things Herself and through |
`\ herself of own accord, rid of all gods.” —Titus Lucretius |
_o__) Carus, c. 40
“Nature hath given men one tongue but two ears, that we may |
`\ hear from others twice as much as we speak.” —Epictetus, |
_o__) _Fragments_ |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ey should get. If they want to take advantage
of a local connection, they can use a Unix domain socket.
--
\ “I wrote a song, but I can't read music so I don't know what it |
`\is. Every once in a while I'll be listening to the radio and I |
_o__) say, ‘I think I
rums http://getnikola.com/contact.html>.
--
\ “I do not believe in forgiveness as it is preached by the |
`\church. We do not need the forgiveness of God, but of each |
_o__)other and of ourselves.” —Robert G. Ingersoll |
Ben Finney
--
https://mai
oughts?
I'd try very hard to find an equivalent URL that isn't so long :-) but
URLs in comments are a good example of a PEP 8 exception: if the line is
over 80 characters because it contains a long URL in a comment, that's
fine, as I'm not expecting the human reader to be scanning it carefully
like other text in the code.
--
\“I fly Air Bizarre. You buy a combination one-way round-trip |
`\ticket. Leave any Monday, and they bring you back the previous |
_o__) Friday. That way you still have the weekend.” —Steven Wright |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Not least because you're very likely going to use the value of
‘file_path’ yet again in the body of that ‘if’ block.
--
\ “Two paradoxes are better than one; they may even suggest a |
`\ solution.” —Edward Teller |
_o__)
ers. Thank you.
--
\ “The most common way people give up their power is by thinking |
`\ they don't have any.” —Alice Walker |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano writes:
> On Thu, 28 Nov 2013 13:47:22 +1100, Ben Finney wrote:
> > [A triple-quoted string is] not syntactically a comment, and I don't
> > think pretending triple-quoted strings are comments is good
> > practice. If nothing else, you'l
\ so, Brain, but three men in a tub? Ooh, that's unsanitary!” |
_o__) —_Pinky and The Brain_ |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
provided with a filename dynamically created by Bash, referring to a
temporary file that contains the output of the subshell.
--
\ “Welchen Teil von ‘Gestalt’ verstehen Sie nicht? [What part of |
`\‘gestalt’ don't you understand?]” —Karsten M. Self |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
27;s article.
--
\ “Pray, v. To ask that the laws of the universe be annulled in |
`\ behalf of a single petitioner confessedly unworthy.” —Ambrose |
_o__) Bierce, _The Devil's Dictionary_, 1906 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
alf of you half as well as I should like, and I |
`\ like less than half of you half as well as you deserve.” —Bilbo |
_o__) Baggins |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
re unpopular because they require |
`\ hard work and discipline to achieve and education to be |
_o__)appreciated.” —Edsger W. Dijkstra |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
“A child of five could understand this. Fetch me a child of |
`\ five.” —Groucho Marx |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Dan Stromberg writes:
> On Mon, Dec 9, 2013 at 10:40 PM, Ben Finney wrote:
> > What information would you want access to? Why would a library
> > (rather than, say, a short set of strings) be needed?
> >
> Movie ratings. EG G, PG, PG-13, etc.
That tells me only tha
at the brain was the most wonderful organ in |
`\ my body. Then I realized who was telling me this.” —Emo Philips |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
a furious |
`\ argument over what I considered to be an odd number.” —Steven |
_o__) Wright |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
;ll be interested to know the rest of that paragraph, to know whether
the above list comprehension meets your constraints.
--
\ “I was in the first submarine. Instead of a periscope, they had |
`\ a kaleidoscope. ‘We're surrounded.’” —Steven Wright |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ives
the command line as a parameter, and returns the exit code.
--
\ “Faith, n. Belief without evidence in what is told by one who |
`\ speaks without knowledge, of things without parallel.” —Ambrose |
_o__) Bierce, _The Devil's Dictionary_, 1906 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ly from several operating systems (e.g.
Debian) or install it yourself. It works with numerous existing mail
clients, and brings the significant advantage of organising one's email
by search, not by exclusive folders.
--
\“Intellectual property is to the 21st century what the slave |
? Is that useful for
determining which branch to take?
--
\ “The fact that a believer is happier than a skeptic is no more |
`\ to the point than the fact that a drunken man is happier than a |
_o__) sober one.” —George Bernard Shaw |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
u tell the users of today about that, and they don't believe you.
--
\ “If nature has made any one thing less susceptible than all |
`\others of exclusive property, it is the action of the thinking |
_o__) power called an idea” —Thomas Jefferson |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Ben Finney writes:
> Larry Martell writes:
>
> > On Wed, Dec 11, 2013 at 8:42 PM, Roy Smith wrote:
> > > rusi wrote:
> > >
> > >> Many assumptions need to be verified/truthified/dovetailed
> > >> starting from switching on the machine
ur way to a time when faith, without evidence, |
`\disgraces anyone who would claim it.” —Sam Harris, _The End of |
_o__) Faith_, 2004 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
ering what I'm pondering?” “I think so, |
`\Brain, but Zero Mostel times anything will still give you Zero |
_o__) Mostel.” —_Pinky and The Brain_ |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
“For fast acting relief, try slowing down.” —Jane Wagner, via |
`\ Lily Tomlin |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
the supply has always been in excess of |
`\ the demand.” —Josh Billings |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico writes:
> On Mon, Dec 16, 2013 at 3:50 PM, Ben Finney
> wrote:
> > Should we expect (ignoring pathological cases) the assertion
> > ‘type(obj) is obj.__class__’ to hold true? If not, under what
> > circumstances would it be sensible for those to diff
my life there.” —Charles F. Kettering |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
g down.” —Jane Wagner, via |
`\ Lily Tomlin |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
for peace. Hitler was for |
`\ peace. Everybody is for peace. The question is: what kind of |
_o__)peace?” —Noam Chomsky, 1984-05-14 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
\ “It is far better to grasp the universe as it really is than to |
`\persist in delusion, however satisfying and reassuring.” —Carl |
_o__) Sagan |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
o Google Groups being scrapped!
--
\ “And if I laugh at any mortal thing, / 'Tis that I may not |
`\ weep.” —“Lord” George Gordon Noel Byron, _Don Juan_ |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
roprietary software packages, is |
`\ being able to choose your master. Freedom means not having a |
_o__) master.” —Richard M. Stallman, 2007-05-16 |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
Michael Torrie writes:
> On 01/05/2014 04:30 PM, Ben Finney wrote:
> > In short: Everything that was good about OpenOffice is now called
> > LibreOffice, which had to change its name only because the owners of
> > that name refused to let it go.
>
> Your information i
grammers need to learn this messy
arbitrary crap, at least to the point of knowing unambiguously what we
ask the computer to do when it interacts with the messy real world.
--
\ “I prayed for twenty years but received no answer until I |
`\ prayed with my legs.” —Frederick Do
Chris Angelico writes:
> On Thu, Jan 9, 2014 at 2:34 PM, Ben Finney wrote:
> > With time zones, as with text encodings, there is a single
> > technically elegant solution (for text: Unicode; for time zones:
> > twelve simple, static zones that never change)
>
> Twe
e responses giving feedback.
--
\ “My girlfriend has a queen sized bed; I have a court jester |
`\ sized bed. It's red and green and has bells on it, and the ends |
_o__) curl up.” —Steven Wright |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
for you? If not, can you explain more precisely what you're
asking?
--
\ “A child of five could understand this. Fetch me a child of |
`\ five.” —Groucho Marx |
_o__) |
w’
function explicitly returns a naive datetime object, not an aware
datetime object.
--
\ “We must respect the other fellow's religion, but only in the |
`\ sense and to the extent that we respect his theory that his |
_o__) wife is beautiful and his children smart.” —Henry
Kushal Kumaran writes:
> Ben Finney writes:
>
> > Kushal Kumaran writes:
> >
> >> Roy Smith writes:
> >> > How, in Python, do you get an aware UTC datetime object?
> >>
> >> classmethod datetime.utcnow()
> >>
> >>
—Edsger W. Dijkstra |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
stdin and stdout are ASCII, largely because it hasn't been told
otherwise.
--
\“The greatest tragedy in mankind's entire history may be the |
`\ hijacking of morality by religion.” —Arthur C. Clarke, 1991 |
_o__) |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
--
\ “Nature hath given men one tongue but two ears, that we may |
`\ hear from others twice as much as we speak.” —Epictetus, |
_o__) _Fragments_ |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
hich exception?)
+1. I'd like a custom exception class, sub-classed from ValueError.
--
\ “I love to go down to the schoolyard and watch all the little |
`\ children jump up and down and run around yelling and screaming. |
_o__) They don't know I'm only using blanks.” —Emo Philips |
Ben Finney
--
https://mail.python.org/mailman/listinfo/python-list
1301 - 1400 of 5102 matches
Mail list logo