conjunction). If you were willing to forgo the
Oxford comma, it would tidy up the code a bit. Sample code below
Why go through all that instead of just converting the iterator into a
list at the beginning of MRAB's solution and then running with it?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
hod (Terry): a function that must be looked up in the class
Have I missed anything?
Honestly-trying-learn-the-distinctions-ly yours,
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Ethan Furman wrote:
Terry Reedy wrote:
On 12/16/2011 4:22 AM, Steven D'Aprano wrote:
On Thu, 15 Dec 2011 19:39:17 -0500, Terry Reedy wrote:
[...]
After reading your post, I think I have worked out where our
disagreement
lies: you think that bound methods and instance methods are no
of the language, but how, and when, is
implementation specific.
Resource management (beyond basic memory allocation) should be handled
directly. Python 3 encourages this by complaining if there were still
open files when it shuts down.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Neal Becker wrote:
Clarification: where can packing/unpacking syntax be used?
It would be great if it were valid essentially anywhere (not limited to
parameter passing).
What about constructs like:
a, @tuple tail, b = sequence?
You mean like Python 3's:
a, *middle, b = sequence
?
--
htt
Steven D'Aprano wrote:
I'm just glad that you've put your money
where your mouth is, and released the package, instead of demanding
others do the work. Thank you.
+1000!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Ian Kelly wrote:
my goal is to write clear code, not great one-liners. :-D
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
as the children will import the __main__
module.
8<---
import multiprocessing
def f():
print('bla bla')
if __name__ == '__main__':
p = multiprocessing.Process(target=f)
p.start()
p.join()
8<--
not write
programs in it. However C++ is a vast, complex, and dangerous
language -- and industry doesn't seem to be willing to limit itself to
using the seven people on the planet who understand it.
I'm only half joking... :)
Ah -- so there's actually 14?
;)
~Ethan~
--
http://
ne to use an already existing list and
get shallow copies of it, yours will only create empty lists.
a, b, c = listgen([1, 2, 3])
# a, b, & c are bound to different lists
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
raise TypeError(
> 'Singletons must be accessed through the `Instance`
> method.')
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
that file, it doesn't work.
Why can't I import this Singleton decorator from a different file?
What's the best work around?
Post the code, and the traceback.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
s.
And then he will learn about it and not make the mistake again (or if he
does, it take much less time to figure it out).
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ple
inheritence was a bug and asking it to be removed.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
GZ wrote:
Hi,
I run into a weird problem. I have a piece of code that looks like the
following:
f(, a=None, c=None):
assert (a==None)==(c==None)
Um -- if you don't want a and c being passed in, why put them in the
function signature?
~Ethan~
--
http://mail.python.org/ma
It
could be useful for a Null type to == None.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Devin Jeanpierre wrote:
Um -- if you don't want a and c being passed in, why put them in the
function signature?
He wants both or neither to be passed in.
Ah -- right.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Andrew Berg wrote:
On 12/31/2011 12:19 PM, davidfx wrote:
Should we always be using .format() for formatting strings or %?
>>
%-style formatting will eventually go away, but
probably not for a long time.
%-style formatting isn't going away.
~Ethan~
--
http://mail.python.
ut having to wade through
crap. PyPI is not the place for it.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ting it is because Python currently has no fewer
than three mechanisms for string formatting (not even including
ordinary string concatenation), which according to the Zen of Python
is two too many.
"one obvious way" != "only one way"
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Ian Kelly wrote:
http://mail.python.org/pipermail/python-dev/2009-September/092399.html
Thanks, that link is very informative.
Here's the link to the last discussion last February:
http://mail.python.org/pipermail/python-dev/2011-February/108155.html
~Ethan~
--
http://mail.pytho
Devin Jeanpierre wrote:
"one obvious way" != "only one way"
Which way is the obvious way? Why is it obvious?
Apparently, %-style is obvious to C and similar coders, while {}-style
is obvious to Java and similar coders.
:)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
x27;%s' % n"
100 loops, best of 3: 0.965 usec per loop
C:\WINDOWS>python -m timeit -n 100 -s "n=7.92" "'{}'.format(n)"
100 loops, best of 3: 1.17 usec per loop
Good information. Thanks.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
accepted norm of our community. And I
hope those of us who prefer to think of ourselves as not-sexist will act
to clean up our house more.
+1
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
their
declaration[2], so that the output becomes more readable and structured,
just as my test code (hopefully) is.
I believe unittest executes tests in alphabetical order, but it does not
display them in the same order when it prints error/fail results.
~Ethan~
--
http://mail.python.org/ma
--> a += b
--> a
[1, 2, 3, 'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd']
IMO, either both + and += should succeed, or both should fail.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ut
is a pain in the backside.
So I am strongly leaning towards implementing the comparisons such that
Null objects are less than other objects so they will always sort together.
Thoughts/advice/criticisms/etc?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
th cases are LYBL, unless of course your addition
was just an example of some mathematical code you have further down.
Personally, I go with EAFP unless I'm trying to present friendlier error
messages.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Python is an excellent option for writing shell scripts,
particularly if your shell is cmd.exe.
I believe having your shell be cmd.exe qualifies as a "good reason"!
:)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
;:
shared_cursor = ...
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 02/06/2013 04:57 PM, Ethan Furman wrote:
On 02/06/2013 04:43 PM, c wrote:
But the function in the module is also within a *class* so I don't
think the function does have access to the module's global namespace.
Here's the hierarchy:
-- Module namespace
On 02/12/2013 10:01 AM, Zero Piraeus wrote:
On 12 February 2013 02:15, Steven D'Aprano wrote:
As an antidote to the ill-informed negativity of Ranting Rick's
illusionary "PyWarts", I thought I'd present a few of Python's more
awesome features [...]
You could call them PyW00ts.
+1 QOTW
--
ht
code.
I was under the impression that the real power of contracts was when
they are /not/ turned off -- the errors we don't catch in development
are the serious ones. ;)
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Greetings!
There was a recent thread on Python-Ideas about adding an enumeration package
to the stdlib. One idea that seemed to be fairly popular (at least I like it a
lot ;)
was the use of a metaclass to automatically assign values when a name lookup
failed.
It was also fairly unpopular and
On 02/23/2013 07:51 AM, Chris Angelico wrote:
Steve, why do you say you're not a developer? A score of languages
under your belt, choosing to write code in your spare time, and
speaking competently on the comparative merits of different languages
and why you made the decision you made - sounds li
On 02/23/2013 10:44 AM, jmfauth wrote:
[snip various stupidities]
jmf
Peter, jmfauth is one of our resident trolls. Feel free to ignore him.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
cmLength2 = 13
.
.
.
ftLength1 + cmLength2 # hey, that's wrong! better throw in a conversion
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 02/24/2013 09:29 AM, Michael Torrie wrote:
On 02/24/2013 09:23 AM, Ethan Furman wrote:
On 02/24/2013 07:46 AM, piterrr.dolin...@gmail.com wrote:> Hi guys,
Question. Have this code
intX = 32 # decl + init int var
intX_asString = None # decl + i
g has a truthy/falsey (something vs
nothing) value
From a different email you said PyScripter was showing you all the dunder methods? You might want to try one of the
others.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 02/24/2013 12:58 PM, Chris Angelico wrote:
On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman wrote:
- no variable declarations, just use 'em
Variable declarations can go either way; Python requires you to name
all globals that you mutate
I'm not sure what you mean -- example?
believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to maintain
X as an integer:
--> intX = 32
--> intX = intX / 3.0
--> intX
10.66
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
off
and stuck on some other object.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 02/24/2013 05:53 PM, Chris Angelico wrote:
On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin
wrote:
On 25 February 2013 01:24, Chris Angelico wrote:
Once again, Ethan gets the short end of the citations stick...
'twarn't me wrote that, he did. Not that it's at all contrary t
an his original, as in my int/float example.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ions...
8<--
class A():
pass
A.method = c_method
8<--
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
The latest version, 0.95.001, is available on PyPI:
http://python.org/pypi/dbf
dbf v0.95.001
=
dbf (also known as python dbase) is a module for reading/writing
dBase III, FP, VFP, and Clipper .dbf database files. It's
an ancient format that still finds lots of use (the most common
ut if it can do that...
use mutt devel or [Al]pine. Text based MUA's and News readers are more
efficient IMO.
I'll take a look at those three. While I certainly prefer Tbird over anything MS has to offer, it certainly has its own
list of irritations.
--
~Ethan~
--
http://mail.py
ult, Sep 29 2012, 17:14:58)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
--> import sys
--> sys.argv
['']
--> sys.argv[1:] = ('this is a test!', )
--> sys.argv
['', 'th
ent objects (which is explicit -- you always know which object
is being used) than having a magic function that changes the object in the background (plus you now have to search
backwards for the last magic invocation to know -- and what if a called function changes it?).
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ot worth the trouble. If you're working with numbers, and speed is an issue, you really
should be using one of the numeric or scientific packages out there.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
#x27;).
Use parens then:
("%.2f" % value) if value else ''
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
to do would be to just change the command name
from exec to something else.
Yeah, that's unfortunate.
I suggest 'execute'. :)
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
with' support would also be cool. __enter__ sets the new global window object whilst saving the old one, and then
__exit__ restores the old one.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ed The Trolls (Anyone!) ;)
Of course, somebody still has to reply so a newcomer doesn't get taken in by
him.
Has anybody else thought that his last few responses are starting to sound
bot'ish?
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
jmf has inflicted on us, I find it /very/
hard to believe that he forgot -- which means he was deliberately lying.
At some point we have to stop being gentle / polite / politically correct and
call a shovel a shovel... er, spade.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
that was a troll so I didn't waste time trying to use whatever they said, or be concerned that the
language I was trying to use and learn was horribly flawed.
If the "truthsquad" posts are so offensive to you, why don't you kill-file them?
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
t a French document that needs to include one
mathematical symbol (or emoji) outside
Latin-1 will double in size as a Python string.
True. But how often do you have the entire document as a single string? Use readlines() instead of read(). Besides,
memory is cheap.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 03/29/2013 07:52 AM, Grant Edwards wrote:
On 2013-03-28, Ethan Furman wrote:
I cannot speak for the borg mind, but for myself a troll is anyone
who continually posts rants (such as RR & XL) or who continuously
hijacks threads to talk about their pet peeve (such as jmf).
Assuming
On 03/29/2013 02:26 PM, ru...@yahoo.com wrote:
On 03/28/2013 02:31 PM, Ethan Furman wrote:
On 03/28/2013 12:54 PM, ru...@yahoo.com wrote:
On 03/28/2013 01:48 AM, Steven D'Aprano wrote:
For someone who delights in pointing out the logical errors of
others you are often remarkably sloppy in
t it is not returning a callable. If it did (and the
callable was appropriate for the iterator), that would also work.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
..]
We are all eagerly waitin' for the new GuG (or GuGO?) language!
I think the 'U' is silent, making it GAG.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
7;re new so don't have all the history with jmf that many of us do, but consider
that the original post was about numbers, had nothing to do with characters or unicode *in any way*, and yet jmf still
felt the need to bring unicode up.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
, it seems to me that, for whatever reason, JMF has reached the end of
his capacity
His capacity, maybe; his time? Not by a long shot. I am positive we will continue to see his uncooperative, bratty*
behavior continue ad nauseum.
--
~Ethan~
*I was going to say childish, but I know plenty
On 04/03/2013 09:10 AM, rusi wrote:
On Apr 3, 6:43 pm, Roy Smith wrote:
This has to inspect the entire string, no? I posted (essentially) this
a few days ago:
if all(ord(c) <= 0x for c in s):
return "it's all bmp"
else:
return "it's got astral cr
it.
Thank you,
Saying 'thank you' does not mitigate you acting like an ass.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
7;t expected to return the
exact same values from sys.getsizeof, are they?
What it boils down to is:
- it can easily be done by hand now
- it's a very uncommon need
ergo:
- it's not worth the time and on-going effort required
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 04/07/2013 04:44 AM, Timothy Madden wrote:
I am ok with the people that like python the way it is.
Really? 'Cause I totally missed that from the subject line...
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
listener class.
Doesn't BlueTooth have a 30 foot range? For locking I'd rather be at 10 or
even 5 feet away.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 04/11/2013 06:57 PM, Mark Janssen wrote:
[blah blah not python blah blah]
Mark, this list if for Python, about Python, helping with Python.
If you want to discuss whatever this idea is, you should do it somewhere else,
as it is *not* Python.
--
~Ethan~
--
http://mail.python.org/mailman
icode inside the program, and only switch back to some kind of
encoding when writing to files/pipes/etc. Since you are going to support python 3 as well you can bump the major
version number and note the backward incompatibility.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 04/14/2013 02:50 PM, Chris Angelico wrote:
Quirky question time!
When you read out a qualified name, eg collections.OrderedDict, do you
read the qualifier ("collections dot ordered dict"), or do you elide
it ("ordered dict")? I ask because it makes a difference to talking
about just one of th
x27;slice' is not an acceptable base type
Well that bumps our count to five then:
--> NoneType = type(None)
--> NoneType
--> class MoreNone(NoneType):
... pass
...
Traceback (most recent call last):
File "", line 1, in
TypeError: type 'NoneType' is not an
were expecting, and what you got; it
was darn near perfect.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 04/20/2013 11:14 AM, Chris Angelico wrote:
Flash forward to current date, and jmf has hijacked so many threads to
moan about PEP 393 that I'm actually happy about this one, simply
because he gave it a new subject line and one appropriate to a
discussion about Unicode.
+1000
--
http://mail.py
r
does? And even the interpreter isn't consistent -- sometimes it will return false (__eq__) and sometimes it will raise
an Exception (__add__).
I hardly think it an abuse of NotImplemented to signal something is not implemented when NotImplemented means, um, not
implemented.
possibly-
you are counting unimplemented rules as true, for some reason
which I don't understand.
The top-level logic we need to enforce is "this configuration doesn't
violate any rules".
Then have your unimplemented rules simply return True. Easy!
And less clear.
--
~Ethan~
--
htt
beats the heck out of typing `import numpy as np` every time you start the interpreter.
--
~Ethan~
*Unless you start playing with injection and stuff.
--
http://mail.python.org/mailman/listinfo/python-list
Try
http://inventwithpython.com/
Al Sweigert is the author, and he has three free ebooks there, and you can also purchase the paper versions if you like.
Looks like it targets 3.1.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
l day kills my eyes.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
made, but once a property's assignment has been called, the property
appears. An example follows:
>>> import pprint
>>> pprint.pprint( a.__dict__ )
{'p': 1}
>>> pprint.pprint( b.__dict__ )
{'p': None}
>>> c = a_class()
>>> pprint.pprint( c.__dict__ )
{}
>>> c.p
>>> pprint.pprint( c.__dict__ )
{}
Is that dictionary population behavior for detecting an uninitialized
property?
Thanks for your help. When my feet are properly wet, I look forward to
contributing to the community.
-- Ethan Kennerly
--
http://mail.python.org/mailman/listinfo/python-list
in the IPython FAQ (http://ipython.scipy.org/moin/FAQ) the doctest
was corrupted in IPython.
-- Ethan
--
http://mail.python.org/mailman/listinfo/python-list
ublic and going
"private" later is more efficient when refactoring. And since properties
have the same access signature as a public member, it can be done without
changes to the client.
-- Ethan
--
http://mail.python.org/mailman/listinfo/python-list
ects at OS
flash look promising (http://osflash.org/ext_howto), but I haven't found the
part that says that my interface made in Macromedia Flash (which is a
fantastic design environment) can be used with my code in Python with a
real-time frame rate.
-- Ethan
--
http://mail.python.org/mailman/listinfo/python-list
ished, even though I'm
flushing the output buffer.
Any thoughts?
Best,
Ethan ([EMAIL PROTECTED])
http://uppertank.net/ethanm/
--
http://mail.python.org/mailman/listinfo/python-list
ust(30),))
sys.stdout.flush()
return self
Is it possible that flushing is prohibited until __exit__ is called?
Best,
Ethan ([EMAIL PROTECTED])
http://uppertank.net/ethanm/
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 28 Feb 2008 15:04:38 -0500, Ethan Metsger <[EMAIL PROTECTED]>
wrote:
>
> I can reproduce the issue in the console. I'm not convinced it's
> actually
> a bug, unless for some reason the interpreter is preventing a buffer
> flush.
Quick question.
Havi
> module?
Yes. I haven't investigated its uses in this context due to the
constraints of the legacy system and general inertia. I'm trying to
duplicate functionality while addressing certain annoyances with the
previous system.
Thanks again for your help!
Best,
Ethan
--
Ethan Metsger
http://uppertank.net/ethanm/
--
http://mail.python.org/mailman/listinfo/python-list
mount* of time, rather than a
certain point during the day, then a time of 0:0:0 should certainly be
False as it would mean no time had passed. However, since midnight does
indeed exist (as many programmers have observed when deadlines approach
;) I would think it should be true.
--
~Ethan
Tim Rowe wrote:
2009/2/22 Mark Dickinson :
On Feb 21, 10:44 pm, Ethan Furman wrote:
--> midnight = datetime.time(0,0,0)
--> bool(midnight)
False
I'd call this a bug.
No more so than zero being false. Zero exists too (check my bank
balance). Once you'
won't
fit comfortably into memory?
~ethan~
--
http://mail.python.org/mailman/listinfo/python-list
x27;t cope with?
Thanks in advance!
~ethan~
--
http://mail.python.org/mailman/listinfo/python-list
sniffer wrote:
On Dec 8, 12:53 pm, Ethan Furman <[EMAIL PROTECTED]> wrote:
Greetings All!
I nearly have support complete for dBase III dbf/dbt files -- just
wrapping up support for dates. The null value has been a hindrance for
awhile but I nearly have that solved as well.
For any wh
Chris Rebert wrote:
On Sun, Dec 7, 2008 at 11:41 PM, Ethan Furman <[EMAIL PROTECTED]> wrote:
Greetings All!
I am implementing a NullDate class in order to mirror dates and datetimes
that have no value (yes, this is for my dbf module :)
I'm still a bit fuzzy about class metho
ink it's
another mark in Python's favor that such self-expression is possible,
and functional.
Yes, Lawrence, I do love writing fun code.
~ethan~
--
http://mail.python.org/mailman/listinfo/python-list
hose last two lines into the class definition so that:
1) they are class attributes (not instance), and
2) they are NullDate type objects?
~ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks wrote:
On Dec 10, 5:26 pm, Ethan Furman <[EMAIL PROTECTED]> wrote:
Greetings List!
I'm writing a wrapper to the datetime.date module to support having no
date. Its intended use is to hold a date value from a dbf file, which
can be empty.
The class is functional at this
Thanks, Carl! Thanks, RDM!
Your examples and ideas are much appreciated.
Many thanks also to everyone else who responded.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
to me.
Out of curiosity, what types of .ini files have one text string per line
without = ? The ones I have seen follow this format:
[section name]
setting1 = a value
setting2 = another value
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
e?
Brian A. Vanderburg II
If memory serves, you can catch the exception, then re-raise it -- this
should hide all the traceback below where you caught it, but still
return the actual error.
Hope this helps.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
had never heard of c-b-o (alas, my degree is
in Business Administration). The reference to the old articles, and
effbot, and the very good explanation of Python's assignment statement
have been invaluable to me and are *very much appreciated*.
Thank you.
~ethan~
--
http://mail.python.org/m
1301 - 1400 of 1941 matches
Mail list logo