to start learning Python
> unless I
> know there is a way.
This isn't my field, but I found:
http://higheredbcs.wiley.com/legacy/college/voet/0470129301/bioinfo_stu/sect4.html
Some of the nice things about Python is it's fairly easy to learn and has good
communi
spt
> parser library in Python came up empty.
It wasn't easy to find, but the previous link I posted did lead to this:
http://www.pymol.org/
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
hould be: if you are writing a single-user
application that happens to need SQL services,
check out SQLite; if you are writing a multi-user or concurrent SQL
application, check out Postgres.
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
At the risk of using actual data, I looked this up at
http://www.sqlite.org/whentouse.html:
Checklist For Choosing The Right Database Engine
* Is the data separated from the application by a network? → choose
client/server
Relational database engines act as a bandwidth-reducing data filt
t once.
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
On 02/18/2015 08:57 PM, Laura Creighton wrote:
> I went and asked your question to Andrew Dalke, who is an expert
> in such things.
Did you happen to ask him about PyMol? Just curious. ;)
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/m
(laptops, desktops,
> tablets, etc.) at roughly the same time, is SQLite going to be 'concurrent'
> enough?
Well, having zero experience with SQLite, but having read the docs just today
[snip snide remark] -- I think you'll be
fine with SQLite under those conditions. :)
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
oprietary (can be licensed from them for big bucks).
Wow, really? I had just started playing with it, but I don't think I'll bother
now.
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
easy enough, I'm just stumped on the
> algorithm itself.
>
> Anybody have an idea?
Use a Counter (collections.Counter), add all sets, then keep any keys with a
count of 2 or more.
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
or.
But the unexpected behavior is not a problem with Python, nor with your library
-- it's a bug in the fellow-programmer's
code, and you can't (or at least shouldn't) try to prevent those kinds of bugs
from manifesting -- they'll just get
bitten somewhere else by th
http://stackoverflow.com/q/5957554/208880
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
Oh, and this one:
http://www.cs.toronto.edu/~tijmen/gnumpy.html
--
~Ethan~
signature.asc
Description: OpenPGP digital signature
--
https://mail.python.org/mailman/listinfo/python-list
When you're working with all those rows at once having just one
object for the third enum value is a useful optimization.
Say you have a class that represents serial ports or your computer. You should get the same object every time you ask
for SerialPort(2).
--
~Ethan~
--
https://mail
On 02/13/2014 09:57 AM, Roy Smith wrote:
In article ,
Ethan Furman wrote:
Say you have a class that represents serial ports or your computer. You
should get the same object every time you ask
for SerialPort(2).
Why? Certainly, you should get objects which refer to the same physical
port
eneck, don't worry about speed, go for readability. In which case I'd go with the
second option, then the first, and definitely avoid the third.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
ice, but I haven't run these through a profiler yet :)
The problem with using indices in the code sample is that if the string is 0 or 1 characters long you'll get an
exception instead of a False.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 02/13/2014 11:20 AM, Ethan Furman wrote:
On 02/13/2014 11:09 AM, Mark Lawrence wrote:
All I can say is that if you're worried about the speed of a single
line of code like the above then you've got problems. Having said
that, I suspect that using an index to extract a single cha
ong:
-> key = ''
--> if key[0] == '<' and key[-1] == '>':
... print "good key!"
... else:
... print "bad key"
...
Traceback (most recent call last):
File "", line 1, in
IndexError: string index out of range
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
ing the slice with an index, but I trust you will catch that with your
unit tests ;)
Personally, I'm willing to spend the few extra milliseconds and use the
foolproof third.
For completeness:
# the slowest method from Peter
$ python -m timeit -s 's = ""' 's.startswi
t that bad! All you have to do is handle the edge case of an empty
string:
s[::len(s)-1 if s else True]
*ducks and runs*
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 02/13/2014 02:13 PM, Chris Angelico wrote:
On Fri, Feb 14, 2014 at 8:33 AM, Ethan Furman wrote:
Oh, it's not that bad! All you have to do is handle the edge case of an
empty string:
s[::len(s)-1 if s else True]
And the edge case of the one-character string.
Oops, my description s
On 02/13/2014 01:24 PM, Roy Smith wrote:
Emile van Sebille wrote:
But I didn't see this one:
s[::len(s)-1]
I love it. I need to add this to my list of Python trivia questions.
Great interview question: What does this do? What is its weakness? How would
you fix it?
--
~
tests.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 02/14/2014 08:54 AM, Marko Rauhamaa wrote:
Here's some advice from a very experienced programmer: become a very
experienced programmer.
+1 QOTW
--
https://mail.python.org/mailman/listinfo/python-list
re its failings?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
obj
convert it to ascii using backslashreplace (to handle any code points over
127)
encode to bytes using 'ascii'
Can anybody think of a use-case for this particular feature?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
amework may allow you to add a string, but under the covers it's converting to bytes -- at which point is up to
the framework.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 02/24/2014 03:55 PM, Steven D'Aprano wrote:
On Mon, 24 Feb 2014 11:54:54 -0800, Ethan Furman wrote:
Greetings!
A PEP is under discussion to add %-interpolation back to the bytes type
in Python 3.5.
Assuming the PEP is accepted, what *will* be added back is:
Numerics:
b
al message was properly indented on Google Groups.
Perhaps you should switch to GG or some non-broken client that
doesn't mangle whitespace.
LOL! How long have you waited to say that? ;)
--
~Ethan
--
https://mail.python.org/mailman/listinfo/python-list
On 03/04/2014 01:55 PM, Igor Korot wrote:
Now the question I have is: how do I properly convert this timestamp
into the datetime object with the milliseconds?
And Mark's point is: How do the docs say to do it? What fails when you
try it that way?
--
~Ethan~
--
https://mail.pytho
s long. He
wrote a Lisp compiler whose backend is Python.
Skip
It's Hy: http://hylang.org
Okay, that looks totally cool. Maybe I'll finally get a handle on LISP! :)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 03/10/2014 08:59 AM, Steven D'Aprano wrote:
With an
automated test, I can provide the arguments, and check the result, but
what are my options for *automatically* supplying input to raw_input?
pexpect?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
ummary; if I run a test method
individually I get the summary)
- I have two classes, but only one is being exercised
- occasionally, one of my gvim windows is unceremoniously killed
(survived only by its swap file)
I'm running the tests under sudo as the routines expect to be run that way.
On 03/11/2014 01:58 PM, Ethan Furman wrote:
Anybody have any ideas?
I suspect the O/S is killing the process. If I manually select the other class to run (which has all successful tests,
so no traceback baggage), it runs normally.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo
On 03/11/2014 03:13 PM, John Gordon wrote:
Ethan Furman writes:
if missing:
raise ValueError('invoices %r missing from batch' % missing)
It's been a while since I wrote test cases, but I recall using the assert*
methods (assertEqual, assertTrue, e
o the target,
the old object is modified instead.
... and reassigned to the target. :) (If it doesn't say that last part, it
should.)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 03/11/2014 08:36 PM, Terry Reedy wrote:
On 3/11/2014 6:13 PM, John Gordon wrote:
In Ethan Furman
writes:
if missing:
raise ValueError('invoices %r missing from batch' % missing)
It's been a while since I wrote test cases, but I recall using the
On 03/12/2014 06:44 AM, Roy Smith wrote:
In article ,
Ethan Furman wrote:
I've tried it both ways, and both ways my process is being killed, presumably
by the O/S.
What evidence do you have the OS is killing the process?
I put a bare try/except around the call to unittest.main, w
On 03/12/2014 04:47 PM, Steven D'Aprano wrote:
top -Mm -d 0.5
Cool, thanks!
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
h the code, depending on exactly which
combination of insanities the bank, the customer, and the company choose to inflict at that moment. ;)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
f the time rather
than time itself.
I don't think that will solve the problem of not wanting to wait three days for
the test to finish. ;)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 03/20/2014 05:37 PM, Steven D'Aprano wrote:
In my experience, such as it is, the hard part about writing code that
works from 2.4 to 3.4 is not the 3 versions but the 2.4 and 2.5 versions.
+1000! (yes, that's factorial ;)
--
~Ethan~
--
https://mail.python.org/mailman/listi
umbers, and the underscore. Considering all the unicode letters and unicode
numbers out there, you shouldn't be lacking for names.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
day ago plus 22 hours and 25 minutes".
I'm not sure whether to admire you for your stick-to-it-iveness, or pity you for the plight you are in. Either the
first or second time I hit a datetime WTF moment I wrote my own wrapper classes.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
some known instance
and the delta value.
Making sense is not the same as user friendly...
"Hey, when did Bob get here?"
"About 15 minutes ago."
vs
"About an hour ago, plus 45 minutes."
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
(datetime.timedelta(-1, -1))
'-1 day, -00:00:01'
'-(1 day, 00:00:01)' should be unambiguous.
Or change the comma to an and:
'-1 day and 00:00:01'
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
if a is not b is not None: ...
Is this an obfuscated coding contest? Why do you opt for a solution that
one has to at least think 2 seconds about when the simplest solution:
if (a is not None) or (b is not None):
is immediately understandable by everyone?
+1
--
~Ethan~
--
https://mail.pytho
the sequence of one-line comments.
But, hey, Guido [1] himself likes the triple-quoted string as comment feature [2], so feel free to use it yourself if
you like.
--
~Ethan~
[1] https://mail.python.org/pipermail/python-dev/2013-March/124947.html
[2] https://mail.python.org/pipermail/python-ideas
make the top-level tree a custom dict that understands tuple keys
should be drilled down?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
at as a one-liner?
Er, idiomatic one liner? No, not really. But a helper function makes
nearly anything into a one-liner:
def traverse(tree, *keys):
t = tree
for k in keys:
t = t[k]
return t
# one-liner
leaf = traverse(tree, *list_of_keys)
+1
Short, simple -- good Py
ype = "festive"
Absolutely not. Currently, the 'continue' key word means "stop processing and go back to the beginning". You would
have it mean "keep going forward". Thus 'continue' would mean both "go backwards" and "go forwards" and would lead to
unnecessary confusion.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
ing the file as a command-line argument to python, you have it include the extension, and that is
exactly the file that python executes. Also, using this method, a .pyc file is not created. Only imported files may
have a .py[co] file automatically created for corresponding .py file.
--
~Ethan~
-
On 04/03/2014 11:49 AM, fbick...@gmail.com wrote:
I put this into pythontutor.com's code visualization tool
(http://goo.gl/XOmMjR) and it makes more sense what's going on.
I thought this was interesting; thought I would share.
That visualization tool is certainly neat, thanks!
On 04/03/2014 07:04 PM, MRAB wrote:
On 2014-04-03 19:23, Ethan Furman wrote:
On 04/03/2014 09:02 AM, Lucas Malor wrote:
In reply to Ian Kelly:
Instead of disabling fallthrough by default, why not disable it all together?
I was tempted but there are cases in which it's useful. An ex
nd it to the top of the loop.
*ahem*
The loop condition is *at* the top of the loop; if it was at the bottom it
would be a do..until. ;)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
less, so this is
no longer a major issue.
Unix maybe, but what about Windows? Is it efficient to create
processes under Windows?
Not a concern until performance is not good enough.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
as static storage
def button(_latched=[0])
push_button = _latched[0]
if not push_button:
button_value = bus.read_byte_data(address, GPIOB)
if button_value > 0:
_latched[0] = push_button = 1
return push_button
- use a class
# implementation left as an exercise for the reader ;)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
t;, "credits" or "license" for more information.
--> class GetIndex(object):
... def __getitem__(self, thing):
... print thing
... return None
...
--> test = GetIndex()
--> test[1]
1
--> test [1,2]
(1, 2)
--> test[1:3, 4:5]
(slice(1, 3, None),
======
Thanks!
--
~Ethan~
[1] Need, or really really really convenient to have. ;)
[2] http://selliott.org/python/
--
https://mail.python.org/mailman/listinfo/python-list
On 04/14/2014 06:33 PM, Dave Angel wrote:
(you really should have put a comment, so we'd know this is line
200, 201)
Sorry, not used to asking questions about C code. ;) I'll make sure and do
that next time.
Thanks for the help!
--
~Ethan~
--
https://mail.python.org/mailma
Thanks to everyone for the pointers. ;)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
Use Python 3 if you can. The best reason not to is if you have some critical library that you absolutely need and it's
not yet available on 3. In which case, program as if your code base was going to run on both 2 and 3 so you can update
easily once your dependency upgrades.
--
~Ethan~
-
source file. I don't like working with large source
files for practicall reasons.
I'm curious what these practical reasons are. One my smallest source files has
870 lines in it, my largest nearly 9000.
If the problem is your editor, you should seriously consider switching.
mber of circles not far from the south pole.
Perhaps my geography is rusty, but I was under the impression that one cannot travel south if one is at the South Pole
(axial, not magnetic).
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
round a walk a mile south to get back to such a location.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 04/30/2014 06:14 AM, Ethan Furman wrote:
On 04/29/2014 03:51 PM, Chris Angelico wrote:
On Wed, Apr 30, 2014 at 8:42 AM, emile wrote:
On 04/29/2014 01:16 PM, Adam Funk wrote:
"A man pitches his tent, walks 1 km south, walks 1 km east, kills a
bear, & walks 1 km north, where he&
On 03/11/2014 01:58 PM, Ethan Furman wrote:
So I finally got enough data and enough of an understanding to write some unit
tests for my code.
The weird behavior I'm getting:
- when a test fails, I get the E or F, but no summary at the end
(if the failure occurs in setUpClass b
e was fruitless.
Any help greatly appreciated.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 04/30/2014 07:42 PM, Ben Finney wrote:
Ethan Furman writes:
I'm running ubuntu 13.04, I have installed python2.7-dev and
python2.7-example, but when I try to run freeze.py I get:
Error: needed directory /usr/lib/python2.7/config not found
Where is ‘freeze.py’? Is there document
7;t figure out how to get Python's email module to add it in the
correct place. It always ends up at the "bottom" of the headers below
From: To: etc. It's supposed to go at the above all the Received:
headers that where there when I received it.
I don't know that it matte
them:
--> def func1():
... a = 1
... b = 2
... swap(locals(), 'a', 'b')
... print a
... print b
...
--> def swap(d, key1, key2):
... print d[key1], d[key2]
... d[key1], d[key2] = d[key2], d[key1]
... print d[key1], d[key2]
...
--> func1()
1 2
uage, or only a small handful of related languages
that all pretty much operate the same as far as variables are concerned. The simple analogies is also helpful for them.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/08/2014 06:28 AM, Grant Edwards wrote:
Yow! All this time I've at been VIEWING a RUSSIAN MIDGET SODOMIZE a HOUSECAT!
Some filtering of your sigs would be appreciated.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
object in a
mug shot? ;)
I guess my point is, calling aliases variables wasn't the misleading part, it was my lack of knowledge that there was
more than one kind of variable possible. Such ignorance is only solved by learning different languages, and isn't aided
if every languag
.
You can tell a C programmer that a Python variable always holds a
pointer to an object, and they get the idea right away ("Oh, so '.' in
Python is the same as '->' in C") and start producing efficient, correct
Python code.
Right up until they want to derefere
On 05/08/2014 07:03 AM, Marko Rauhamaa wrote:
Ethan Furman :
On 05/08/2014 05:41 AM, Roy Smith wrote:
For those people, talking about variables as a container to hold a
value is the right level of abstraction.
Teaching someone that Python variables are containers is a massive fail.
But
https://mail.python.org/pipermail/python-list/2009-February/526909.html
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/08/2014 11:39 AM, Grant Edwards wrote:
Yep. I've removed a few of them from the file over the years because
some people were offended by them. And I'll continue to do so...
Thanks, much appreciated.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
What happens if you run the same matrix through Octave? By any chance, is nom
just really, really small?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
ariables at run time.
See module example above. This behavior is not allowed in functions for scope
and sanity (mostly sanity) reasons.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
ne; please stop muddying other's understanding of
how Python the language works.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
akes it clearer to the user what the
problem is.
Absolutely. At one point NameError was raised in both cases, which could be
very confusing to track down.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/10/2014 04:18 PM, Chris Angelico wrote:
On Sun, May 11, 2014 at 5:10 AM, Ethan Furman wrote:
And if you don't like that argument (although it is a perfectly sound and
correct argument), think of the module name space:
ret = spam
spam = 23
will net you a simple NameError, because
guarantee.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/10/2014 10:22 PM, Chris Angelico wrote:
It's that declaration that creates the variable, not
changing locals().
A Python variable is a name bound to a value (and values, of course, are objects). If you don't have both pieces, you
don't have a Python variable.
--
~
How the lights and/or windshield wipers turn on/off is also an important detail.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
file objects are binary.
What surprises me is how hard that is. Surely there's a simpler way to
open stdin and stdout in binary mode? If not, there ought to be.
Somebody already posted this:
https://docs.python.org/3/library/sys.html#sys.stdin
which talks about .detach().
--
~Ethan
shes won't work, etc.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
y context (important after four years!) so what are you talking about? And did you target the
correct list?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/22/2014 11:54 AM, Aseem Bansal wrote:
I am working on a hobby project - a Bookmarker
https://github.com/anshbansal/Bookmarker.
Take a look at delicio.us -- it seems to be a similar type of experience.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
suds, any idea of migrating is a total
non-starter for us. I imagine they're all working on ports, but I'll
check back in a year and see how things stand.
Don't imagine. Send 'em an email! Let them know there is one more user who'd
like a Python 3 port.
--
~Eth
f you want
to migrate to Python 3, help that library forward, rather than trying
to make some bespoke replacement you think will be a killer app.
+1
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/24/2014 11:43 PM, wxjmfa...@gmail.com wrote:
Python and unicode: a buggy hobbyist toy.
Voilà. Nothing either good or bad.
I thought this was a moderated list. What exactly are the moderators doing?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/25/2014 10:38 AM, Rustom Mody wrote:
Your unicode is mojibaked Ethan! Voil�.
You are hereby banished to a lonely island with python 1.5 and jmf for company
:D
1.5 I could live with. :( Surely the company would count as cruel and
unusual punishment?
--
~Ethan~
--
https
On the same preferences
screen TB provides the option to "when possible, use the default
character encoding in replies".
Thanks, fixed. :)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 05/25/2014 03:22 PM, Dennis Lee Bieber wrote:
On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman
declaimed the following:
On 05/25/2014 10:38 AM, Rustom Mody wrote:
Your unicode is mojibaked Ethan! Voilà.
You are hereby banished to a lonely island with python 1.5 and jmf for company
:D
a big deal.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
aight-forward. I guess I'm not
as smart as you. I won't beat it anymore.
Deb, do yourself a favor and just trash-can anything from Mark Harris.
And keep asking questions.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
s are usually quite small (well under 100 characters) so an implementation that
wasn't O(1) would not hurt me much.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
is so
- check that the interpreter behaves consistently with the docs
But yes, I otherwise agree with you.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
1001 - 1100 of 1941 matches
Mail list logo