On Tue, 07 May 2013 15:17:52 +0100, Steve Simmons wrote:
> Good to see jmf finally comparing apples with apples :-)
*groans*
Truly the terrible pun that the terrible hijacking deserves.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 07 May 2013 19:51:24 -0500, Andrew Berg wrote:
> On 2013.05.07 19:14, Dave Angel wrote:
>> You also need to decide how to handle Unicode characters, since they're
>> different for different OS. In Windows on NTFS, filenames are in
>> Unicode, while on Unix, filenames are bytes. So on one
On Wed, 08 May 2013 00:13:20 -0400, Dave Angel wrote:
> On 05/07/2013 11:40 PM, Steven D'Aprano wrote:
>>
>>
>>
>> These are all Unicode characters too. Unicode is a subset of ASCII, so
>> anything which is ASCII is also Unicode.
>>
>>
>
I'm looking for some help in finding a term, it's not Python-specific but
does apply to some Python code.
This is an anti-pattern to avoid. The idea is that creating a resource
ought to be the same as "turning it on", or enabling it, or similar. For
example, we don't do this in Python:
f = fi
On Wed, 08 May 2013 11:13:33 +0100, Robert Kern wrote:
> On 2013-05-08 09:52, Steven D'Aprano wrote:
>> I'm looking for some help in finding a term, it's not Python-specific
>> but does apply to some Python code.
>>
>> This is an anti-pattern to a
On Wed, 08 May 2013 16:20:48 -0400, Roy Smith wrote:
> FooEntry is a class. How would you describe a list of these in a
> docstring?
Which language are you writing your docstrings in? Obey the normal rules
of spelling, grammar and punctuation for your language, which I assume is
English.
>
On Wed, 08 May 2013 15:33:07 -0500, Skip Montanaro wrote:
> This one:
>
>> "A list of FooEntry instances"
>
> Besides the obvious spelling issues in the others, it's not immediately
> clear if the list contains just FooEntry instances, FooEntry classes
> (perhaps subclasses) or a mix of the two.
On Wed, 08 May 2013 20:16:25 -0400, Roy Smith wrote:
> Yup. At Songza, we deal with this crap every day. It usually bites us
> the worst when trying to do keyword searches. When somebody types in
> "Blue Oyster Cult", they really mean "Blue Oyster Cult",
Surely they really mean Blue Öyster Cu
On Wed, 08 May 2013 21:11:28 -0500, Andrew Berg wrote:
> It's a thing (especially in witch house) to make names with odd glyphs
> in order to be harder to find and be more "underground". Very silly. Try
> doing searches for these artists with names like these:
Challenge accepted.
> http://www.la
On Wed, 08 May 2013 14:27:53 +, Duncan Booth wrote:
> Steven D'Aprano wrote:
>
>> I'm looking for some help in finding a term, it's not Python-specific
>> but does apply to some Python code.
>>
>> This is an anti-pattern to avoid. The idea i
On Thu, 09 May 2013 02:42:01 +, Dan Sommers wrote:
> On Wed, 08 May 2013 08:52:12 +0000, Steven D'Aprano wrote:
>
>> This is an anti-pattern to avoid. The idea is that creating a resource
>> ought to be the same as "turning it on", or enabling it, or similar.
On Thu, 09 May 2013 02:38:36 +, Dan Sommers wrote:
> Think of spinning off a thread: initialize it synchronously, and then
> let it execute asynchronously. We tend towards that pattern even when
> we know that execution will be synchronous, because we also that it
> could be asynchronous one
On Wed, 08 May 2013 19:35:58 -0700, Mark Janssen wrote:
> Long story short: the lambda
> calculus folks have to split from the Turing machine folks.
> These models of computation should not use the same language. Their
> computation models are too radically different.
Their computation models
On Thu, 09 May 2013 01:18:51 -0700, RAHUL RAJ wrote:
> Then what about this code part?
What about it?
> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
>
> and the following code part:
>
> for x in [1,2,3]:
> for y in [3,1,4]:
> if x != y:
> combs.append((x, y))
Apart from
On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote:
> On 09May2013 19:54, Greg Ewing wrote:
> | Steven D'Aprano wrote:
> | > There is no sensible use-case for creating a file WITHOUT OPENING
> | > it. What would be the point?
> |
> | Early unix systems often u
On Thu, 09 May 2013 06:08:25 -0500, Wayne Werner wrote:
> Ah, that's it - the problem is that it introduces /Temporal Coupling/ to
> one's code: http://blog.ploeh.dk/2011/05/24/DesignSmellTemporalCoupling/
Good catch!
That's not the blog post I read, but that's the same concept. "Temporal
Coupl
On Thu, 09 May 2013 09:07:42 -0400, Roy Smith wrote:
> In article <518b32ef$0$11120$c3e8...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> There is no sensible use-case for creating a file without opening it.
>
> Sure there is. Sometimes just creating the
On Thu, 09 May 2013 19:34:25 +0100, MRAB wrote:
>> There is no sensible use-case for creating a file OBJECT unless it
>> initially wraps an open file pointer.
>>
> You might want to do this:
>
> f = File(path)
> if f.exists():
> ...
>
> This would be an alternative to:
>
> if os.path.exist
On Thu, 09 May 2013 23:09:55 -0400, Roy Smith wrote:
> In article <518c5bbc$0$29997$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> I must admit I am astonished at how controversial the opinion "if your
>> object is useless until you c
On Fri, 10 May 2013 09:36:43 +1000, Cameron Simpson wrote:
> On 09May2013 11:30, Steven D'Aprano
> wrote:
> | On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote:
> |
> | > On 09May2013 19:54, Greg Ewing wrote:
> | > | Steven D'Aprano wrote:
> | &g
On Fri, 10 May 2013 01:50:09 -0400, Roy Smith wrote:
> In article <518c7f05$0$29997$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> there is no way to create a C file descriptor in a closed state. Such a
>> thing does not exist. If you hav
On Fri, 10 May 2013 06:22:31 +, Dan Sommers wrote:
> On Fri, 10 May 2013 05:03:10 +0000, Steven D'Aprano wrote:
>
>>>>> There is no sensible use-case for creating a file OBJECT unless it
>>>>> initially wraps an open file pointer.
>
>> So
On Sat, 11 May 2013 01:16:36 +1000, Chris Angelico wrote:
> On Sat, May 11, 2013 at 1:06 AM, jmfauth wrote:
>> On 8 mai, 15:19, Roy Smith wrote:
>>> Apropos to any of the myriad unicode threads that have been going on
>>> recently:
>>>
>>> http://xkcd.com/1209/
>>
>> --
>>
>>
>> This reflect
On Fri, 10 May 2013 17:59:26 +0100, Nobody wrote:
> On Thu, 09 May 2013 05:23:59 +0000, Steven D'Aprano wrote:
>
>> There is no sensible use-case for creating a file without opening it.
>> What would be the point? Any subsequent calls to just about any method
>> will
On Fri, 10 May 2013 18:20:34 +0100, Robert Kern wrote:
> According to Steven's criteria, neither of these are instances of the
> anti-pattern because there are good reasons they are this way. He is
> reducing the anti-pattern to just those cases where there is no reason
> for doing so.
But isn't
On Sat, 11 May 2013 21:45:12 -0700, rusi wrote:
> I have on occasion expressed that newcomers to this list should be
> treated with more gentleness than others. And since my own joking may be
> taken amiss, let me hasten to add (to the OP -- Citizen Kant)
A noble aim, but I have a feeling that "C
On Sun, 12 May 2013 16:17:02 +0200, Citizen Kant wrote:
> Any clue about this would be highly appreciated.
If you are interested in the intersection of programming and philosophy,
I strongly recommend that you read "Gödel, Escher, Bach: An Eternal
Golden Braid" by Douglas R. Hofstadter.
--
On Sun, 12 May 2013 04:15:30 -0400, Devin Jeanpierre wrote:
> On Sun, May 12, 2013 at 1:17 AM, Steven D'Aprano
> wrote:
>> On Sat, 11 May 2013 21:45:12 -0700, rusi wrote:
>>
>>> I have on occasion expressed that newcomers to this list should be
>>> trea
On Sat, 11 May 2013 22:03:15 +0200, Citizen Kant wrote:
> Hi,
> this could be seen as an extravagant subject but that is not my original
> purpose. I still don't know if I want to become a programmer or not. At
> this moment I'm just inspecting the environment.
Towards what purpose?
Do you want
On Mon, 13 May 2013 12:34:13 +1200, Gregory Ewing wrote:
> In the most general terms, the Python interpeter (or any other computer
> system, for that matter) can be thought of as something with an internal
> state, and a transition function that takes the state together with some
> input and produ
On Sun, 12 May 2013 16:17:02 +0200, Citizen Kant wrote:
> Thank you very much for your answers.
>
> I'm afraid that, at this stage, I must prevent myself from "knowing too
> much" about the subject. My idea here is trying to fill the gaps,
> mostly, using intuition.
Then you are doomed to failur
Some further details on something mentioned about Python being
"economical".
On Sun, 12 May 2013 16:17:02 +0200, Citizen Kant wrote:
> For example: I'm plainly aware that the word "python" looks shorten than
> "0111 0001 01110100 01101000 0110 01101110". But it's
> shorten just for m
My, it's been a long time since I've seen these:
http://pu.inf.uni-tuebingen.de/users/klaeren/epigrams.html
They pre-date the Zen of Python by at least a decade, and quite frankly I
think many of them miss the mark. But whether you agree or disagree with
them, they're worth reading.
--
Stev
On Mon, 13 May 2013 10:24:40 +0100, Mark Lawrence wrote:
> That's the title of this little beast
> http://www.acooke.org/cute/Pythonssad0.html if anybody's interested.
Well, that's one way of looking at it. And I can't exactly *disagree*.
But... but...
In many ways, it's a dull language, b
On Mon, 13 May 2013 13:00:36 +0200, Jean-Michel Pichavant wrote:
> - Original Message -
>> That's the title of this little beast
>> http://www.acooke.org/cute/Pythonssad0.html if anybody's interested.
>>
>> --
>> If you're using GoogleCrap™ please read this
>> http://wiki.python.org/moin/
On Mon, 13 May 2013 19:22:24 -0400, Dave Angel wrote:
> So which special methods should the <> operator call? By rights it
> ought to call both __gt__ and __lt__ and return True if either of them
> is True.
The <> operator comes from Pascal, where it was used as "not equal" since
ASCII doesn't
On Mon, 13 May 2013 21:17:41 +, Alister wrote:
> I would then still write it as not (x == y) to make it clear to myself &
> avoid any possible confusion although I think that X != Y is much
> cleaner.
I think that is sad. If I read "not (x == y)" I would assume that the
person writing the co
On Tue, 14 May 2013 01:32:43 +0200, Citizen Kant wrote:
> An entity named Python must be somehow as a serpent. Don't forget that
> I'm with the freeing up of my memory, now I'm not trying to follow the
> path of what's told but acting like the monkey and pushing with my
> finger against the skin o
On Tue, 14 May 2013 19:01:38 -0400, Dennis Lee Bieber wrote:
> On 14 May 2013 05:09:48 GMT, Steven D'Aprano
> declaimed the following in
> gmane.comp.python.general:
>> The <> operator comes from Pascal, where it was used as "not equal"
>> since
>
&
On Wed, 15 May 2013 13:16:09 +0100, Oscar Benjamin wrote:
> I don't generally use super()
Then you should, especially in Python 3.
If you're not using super in single-inheritance classes, then you're
merely making your own code harder to read and write, and unnecessarily
difficult for others
I wish to generate some test data for a program that deals with emails. I
need something that can produce multi-part emails, including "broken"
emails that violate email standards, especially when it comes to Unicode.
Does anyone know of something like this that already exists? It's not
necessa
On Thu, 16 May 2013 00:48:45 -0700, Charles Smith wrote:
> Hi.
>
> How can I say, from the cmd line, that python should take my CWD as my
> CWD, and not the directory where the script actually is?
*scratches head*
Python does use your current working directory as your current working
directory
On Fri, 17 May 2013 01:35:49 +0530, Chitrank Dixit wrote:
> I want to know how relative imports are different than import. I have
> found lots of examples on internet explaining about the relative import
> but I want to know about the basic aspects of relative import that make
> it different than
On Thu, 16 May 2013 20:20:26 -0700, lokeshkoppaka wrote:
> I need to write numbers into a file upto 50mb and it should be fast can
> any one help me how to do that?
> i had written the following code..
> --
> def create_file_numbe
On Fri, 17 May 2013 18:20:33 +0300, Carlos Nepomuceno wrote:
> I've got the following results on my desktop PC (Win7/Python2.7.5):
>
> C:\src\Python>python -m timeit -cvn3 -r3 "execfile('fastwrite2.py')" raw
> times: 123 126 125
> 3 loops, best of 3: 41 sec per loop
Your times here are increased
On Fri, 17 May 2013 18:20:33 +0300, Carlos Nepomuceno wrote:
> ### fastwrite5.py ###
> import cStringIO
> size = 50*1024*1024
> value = 0
> filename = 'fastwrite5.dat'
> x = 0
> b = cStringIO.StringIO()
> while x < size:
> line = '{0}\n'.format(value)
> b.write(line)
> value += 1
>
On Fri, 17 May 2013 21:18:15 +0300, Carlos Nepomuceno wrote:
> I thought there would be a call to format method by "'%d\n' % i". It
> seems the % operator is a lot faster than format. I just stopped using
> it because I read it was going to be deprecated. :( Why replace such a
> great and fast ope
On Sat, 18 May 2013 10:03:02 -0400, Beinan Li wrote:
> Do you think tkinter is going to be the standard python built-in gui
> solution as long as python exists?
Probably.
> I couldn't help but wonder if wx or PySide receives better py2 and py3
> support, or anything else that prevent them from g
On Sat, 18 May 2013 15:14:31 -0400, Dennis Lee Bieber wrote:
> tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos
> declaimed the following in
> gmane.comp.python.general:
>
>
>> You mentioned "\n" translating to two lines, but this won't happen.
>> Windows will not mess with what you write to y
On Mon, 20 May 2013 10:55:35 +0300, Carlos Nepomuceno wrote:
> I understand your motivation but I don't know what protection
> ast.literal_eval() is offering that eval() doesn't.
eval will evaluate any legal Python expression:
py> eval("__import__('os').system('echo Mwahaha! Now you are pwned!'
On Mon, 20 May 2013 15:26:02 +0200, Frank Millman wrote:
> Can anyone see anything wrong with the following approach. I have not
> definitely decided to do it this way, but I have been experimenting and
> it seems to work.
>
> I store the boolean test as a json'd list of 6-part tuples. Each eleme
On Tue, 21 May 2013 05:53:46 +0300, Carlos Nepomuceno wrote:
> BTW, why I didn't find the source code to the sys module in the 'Lib'
> directory?
Because sys is a built-in module. It is embedded in the Python
interpreter.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 21 May 2013 08:30:03 +0200, Frank Millman wrote:
> On 20/05/2013 18:12, Steven D'Aprano wrote:
>> Personally, I would strongly suggest writing your own mini- evaluator
>> that walks the list and evaluates it by hand. It isn't as convenient as
>> just calli
For maths nerds like me, this is too cool for words:
http://www.johndcook.com/blog/2013/04/30/recognizing-numbers/
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 21 May 2013 23:22:24 +0300, Carlos Nepomuceno wrote:
> Anyway, is it possible to overload str.__mod__() without deriving a
> class? I mean to have something like:
No, not in Python. If you want to monkey-patch built-in classes on the
fly, with all the troubles that causes, use Ruby.
--
On Tue, 21 May 2013 14:53:54 -0500, Andrew Berg wrote:
> On 2013.05.21 14:26, Mark Lawrence wrote:
>> Please stop perpetuating this myth, see
>> http://mail.python.org/pipermail/python-dev/2012-February/116789.html
>> and http://bugs.python.org/issue14123
>>
> What myth?
The myth that % string
On Wed, 22 May 2013 05:56:53 +0300, Carlos Nepomuceno wrote:
>
>> From: steve+comp.lang.pyt...@pearwood.info Subject: Re: PEP 378: Format
>> Specifier for Thousands Separator Date: Wed, 22 May 2013 02:42:56 +
>> To: python-list@python.org
>>
>> On Tue,
On Wed, 22 May 2013 03:59:55 +, Joseph L. Casale wrote:
> I was doing some work with the ldap module and required a ci dict that
> was case insensitive but case preserving. It turned out the cidict class
> they implemented was broken with respect to pop, it is inherited and not
> re implemente
On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote:
> I didn't mean to create a tempest in a teapot. I was away from
> comp.lang.python, python-bugs, and python-dev for a few years. In
> particular, I didn't ever see the aforementioned thread from Feb 2012.
> Had I known of that thread I
On Wed, 22 May 2013 22:31:04 +, Alister wrote:
> Please write out 1000 time (without using any form of loop)
>
> "NEVER use input in python <3.0 it is EVIL"*
>
> as Chris A point out it executes user input an can cause major damage
> (reformatting the hard disk is not impossible!)
Is he all
On Fri, 24 May 2013 01:14:45 -0700, Peter Brooks wrote:
> What is the easiest way to reorder a sequence pseudo-randomly?
import random
random.shuffle(sequence)
The sequence is modified in place, so it must be mutable. Lists are okay,
tuples are not.
> That is, for a sequence 1,2,3,4 to produ
On Fri, 24 May 2013 04:40:22 -0700, RVic wrote:
> I'm trying to figure out (or find an example) of polymorphism whereby I
> pass a commandline argument (a string) which comports to a class (in
> java, you would say that it comports to a given interface bu I don't
> know if there is such a thing in
On Fri, 24 May 2013 06:23:14 -0700, Peter Brooks wrote:
> Thanks for the warnings about random numbers too - I hope my lists will
> be short enough for the permutations of the function to be irrelevant. I
> don't need every single sequence to be unique, only that the same
> sequence only occurs o
On Fri, 24 May 2013 22:39:06 -0700, lokeshkoppaka wrote:
> On Saturday, May 25, 2013 10:54:01 AM UTC+5:30, Chris Angelico wrote:
>> In that case, you're not really ordering them, you're counting them.
>> Look at the collections module; you can very easily figure out how
>> many of each there are,
On Sat, 25 May 2013 16:41:58 +1000, Chris Angelico wrote:
> On Sat, May 25, 2013 at 4:38 PM, zoom wrote:
>> But why would anyone want to use IPv6?
>
> I hope you're not serious :)
He's planning to drop off the Internet once the IP address run out.
--
Steven
--
http://mail.python.org/mailman
On Sat, 25 May 2013 19:14:57 +1000, Chris Angelico wrote:
> def random_number():
> return 7
I call shenanigans! That value isn't generated randomly, you just made it
up! I rolled a die *hundreds* of times and not once did it come up seven!
--
Steven
--
http://mail.python.org/mailman/lis
On Fri, 24 May 2013 23:05:17 -0700, lokeshkoppaka wrote:
> On Saturday, May 25, 2013 11:27:38 AM UTC+5:30, Steven D'Aprano wrote:
>> tally = 0
>> for item in list_of_items:
>> if item == 0:
>> tally = tally + 1
>>
>> print "The numbe
On Sat, 25 May 2013 18:11:11 +0530, Asad Hasan wrote:
> I have started leaning Python through web . Would like to know
> if I should follow any book so that basics become clear with examples
Reading books is a good thing to do.
> also
> want to know like in perl i use to invoke perl -d to get
On Sun, 26 May 2013 01:41:58 +1000, Chris Angelico wrote:
> On Sun, May 26, 2013 at 12:28 AM, Steven D'Aprano
> wrote:
>> On Sat, 25 May 2013 19:14:57 +1000, Chris Angelico wrote:
>>
>>> def random_number():
>>> return 7
>>
>> I call shena
On Sun, 26 May 2013 03:23:44 +1000, Chris Angelico wrote:
> Does adding 1 to a random
> number make it less random? It adds determinism to the number; can a
> number be more deterministic while still no less random?
>
> Ah! I know. The answer comes from common sense:
[snip spurious answer]
I kno
On Sat, 25 May 2013 21:54:43 -0400, Roy Smith wrote:
> Of course not every IPv6 endpoint will be able to talk to every other
> IPv6 endpoint, even if the both have globally unique addresses. But,
> the access controls will be implemented in firewalls with appropriately
> coded security policies.
On Sun, 26 May 2013 11:58:09 +1000, Chris Angelico wrote:
> On Sun, May 26, 2013 at 11:54 AM, Roy Smith wrote:
>> Of course not every IPv6 endpoint will be able to talk to every other
>> IPv6 endpoint, even if the both have globally unique addresses. But,
>> the access controls will be implemen
On Sun, 26 May 2013 04:11:56 -0700, Ahmed Abdulshafy wrote:
> Hi,
> I'm having a hard time wrapping my head around short-circuit logic
> that's used by Python, coming from a C/C++ background; so I don't
> understand why the following condition is written this way!
>
> if not allow_zero and a
On Sun, 26 May 2013 16:22:26 -0400, Roy Smith wrote:
> In article ,
> Terry Jan Reedy wrote:
>
>> On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote:
>>
>> > if not allow_zero and abs(x) < sys.float_info.epsilon:
>> > print("zero is not allowed")
>>
>> The reason for the orde
On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote:
> Where can I find all error codes and messages that Python throws (actual
> codes and messages from exceptions raised by stdlib)?
There is no list. It is subject to change from version to version,
including point releases.
Many funct
On Sun, 26 May 2013 21:32:40 -0700, Avnesh Shakya wrote:
> But I want to compare line by line and value by value. but i found that
> json data is unordered data, so how can i compare them without sorting
> it. please give me some idea about it. I am new for it. I want to check
> every value line b
On Sun, 26 May 2013 21:48:34 -0700, lokeshkoppaka wrote:
> def shuffle(input, i, j):
> pass
> input = input[i:j+1] +input[0:i] + input[j+1:]
"pass" does nothing. Take it out.
> def test_shuffle():
> input = [1, 2, 3, 4, 5, 6]
> shuffle(input, 1, 2)
> assert [2, 3, 1, 4, 5,
On Mon, 27 May 2013 13:46:50 +0100, Fábio Santos wrote:
> Speaking of PEPs and exceptions. When do we get localized exceptions?
We're waiting for you to volunteer. When can you start?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 27 May 2013 16:45:05 +0200, Mok-Kong Shen wrote:
> From an int one can use to_bytes to get its individual bytes, but how
> can one reconstruct the int from the sequence of bytes?
Here's one way:
py> n = 11999102937234
py> m = 0
py> for b in n.to_bytes(6, 'big'):
... m = 256*m + b
...
On Mon, 27 May 2013 11:30:18 -0400, Ned Batchelder wrote:
> On 5/27/2013 10:45 AM, Mok-Kong Shen wrote:
>> From an int one can use to_bytes to get its individual bytes, but how
>> can one reconstruct the int from the sequence of bytes?
>>
>>
> The next thing in the docs after int.to_bytes is int.f
On Tue, 28 May 2013 17:15:51 +1000, Chris Angelico wrote:
> Can we internationalize English instead of localizing Python?
We have. English is the primary international language for programmers.
(For which I am profoundly grateful.)
Japanese is also a pretty important language, but mostly in Jap
On Mon, 27 May 2013 13:11:28 -0700, Ahmed Abdulshafy wrote:
> That may be true for integers, but for floats, testing for equality is
> not always precise
Incorrect. Testing for equality is always precise, and exact. The problem
is not the *equality test*, but that you don't always have the numbe
On Tue, 28 May 2013 01:39:09 -0700, Ahmed Abdulshafy wrote:
> He just said that the way to test for zero equality is x == 0, and I
> meant that this is true for integers but not necessarily for floats. And
> that's not specific to Python.
Can you show me a value of x where x == 0.0 returns False,
On Tue, 28 May 2013 15:14:03 +, Grant Edwards wrote:
> On 2013-05-28, Steven D'Aprano
> wrote:
>> On Tue, 28 May 2013 01:39:09 -0700, Ahmed Abdulshafy wrote:
>>
>>> He just said that the way to test for zero equality is x == 0, and I
>>> mea
On Tue, 28 May 2013 11:32:06 -0400, JackM wrote:
> Having a problem getting a py script to execute. Got this error:
>
> File "/scripts/blockIPv4.py", line 19
> ip = line.split(';')[0]
> ^
> IndentationError: expected an indented block
>
>
> I'm perplexed because the code that the err
On Tue, 28 May 2013 18:25:59 -0400, Joel Goldstick wrote:
> I wonder
> if it is a good idea in general to try to write code like this. --
> combined 2.x/3.x codebase can be a bear to maintain.
Not so much a bear as a tiny little kitten.
> I wouldn't do it
> unless there was some imposing reaso
On Wed, 29 May 2013 10:50:47 -0600, Ian Kelly wrote:
> On Wed, May 29, 2013 at 8:33 AM, rusi wrote:
>> 0.0 == 0.0 implies 5.4 == 5.4
>> is not a true statement is what (I think) Steven is saying. 0 (or if
>> you prefer 0.0) is special and is treated specially.
>
> It has nothing to do with 0 bei
On Wed, 29 May 2013 11:20:59 -0400, Roy Smith wrote:
>> How to process (read) YAML files in Python?
>
> Take a look at http://pyyaml.org/
Beware that pyaml suffers from the same issue as pickle, namely that it
can execute arbitrary code when reading untrusted data.
--
Steven
--
http://mail.
On Wed, 29 May 2013 07:27:40 -0700, Ahmed Abdulshafy wrote:
> On Tuesday, May 28, 2013 3:48:17 PM UTC+2, Steven D'Aprano wrote:
>> On Mon, 27 May 2013 13:11:28 -0700, Ahmed Abdulshafy wrote:
>>
>>
>>
>> > That may be true for integers, but for floats,
On Wed, 29 May 2013 20:23:00 -0400, Dave Angel wrote:
> Even in a pure decimal system of (say)
> 40 digits, I could type in a 42 digit number and it would get quantized.
> So just because two 42 digit numbers are different doesn't imply that
> the 40 digit internal format would be.
Correct, and
On Thu, 30 May 2013 13:45:13 +1000, Chris Angelico wrote:
> Let's suppose someone is told to compare floating point numbers by
> seeing if the absolute value of the difference is less than some
> epsilon.
Which is usually the wrong way to do it! Normally one would prefer
*relative* error, not a
On Thu, 30 May 2013 02:37:35 +0800, Ma Xiaojun wrote:
> For pure procedural paradigm, I haven't seen much advantages of Python.
Nice syntax with a minimum of boiler plate -- "executable pseudo-code",
as they say. Extensive library support -- "batteries included". These are
both good advantages
On Wed, 29 May 2013 12:46:19 -0500, Croepha wrote:
> Is there anything like this in the standard library?
>
> class AnyFactory(object):
> def __init__(self, anything):
> self.product = anything
> def __call__(self):
> return self.product
> def __repr__(self):
>
On Thu, 30 May 2013 10:22:02 +0300, Jussi Piitulainen wrote:
> I wonder why floating-point errors are not routinely discussed in terms
> of ulps (units in last position). There is a recipe for calculating the
> difference of two floating point numbers in ulps, and it's possible to
> find the previ
On Fri, 31 May 2013 01:56:09 +1000, Chris Angelico wrote:
> On Fri, May 31, 2013 at 1:02 AM, Ethan Furman
> wrote:
>> On 05/30/2013 05:58 AM, Chris Angelico wrote:
>>> If you iterate from 1000 to 173, you get nowhere. This is the expected
>>> behaviour; this is what a C-style for loop would be wr
On Thu, 30 May 2013 16:40:52 +, Steven D'Aprano wrote:
> On Fri, 31 May 2013 01:56:09 +1000, Chris Angelico wrote:
>> You're assuming you can casually hit Ctrl-C to stop an infinite loop,
>> meaning that it's trivial. It's not. Not everything lets you
On Thu, 30 May 2013 10:12:22 -0700, rusi wrote:
> On Thu, May 30, 2013 at 9:34 AM, Ma Xiaojun
> wrote:
>> Wait a minute! Isn't the most nature way of doing/thinking "generating
>> 9x9 multiplication table" two nested loop?
>
> Thats like saying that the most natur(al) way of using a car is to
>
On Thu, 30 May 2013 18:14:36 +, Ana Marija Sokovic wrote:
> Hi,
>
> Can somebody explain to me how would you proceed in releasing the GIL
> and whether you think it will have consequences?
In pure Python code, you don't need to worry about the GIL, and in fact
you cannot control it. Python
On Fri, 31 May 2013 00:03:13 +0300, Carlos Nepomuceno wrote:
>
>> From: steve+comp.lang.pyt...@pearwood.info Subject: Re: Short-circuit
>> Logic
>> Date: Thu, 30 May 2013 05:42:17 + To: python-list@python.org
> [...]
>> Here's another way, mathematicall
On Fri, 31 May 2013 09:42:38 +0300, Carlos Nepomuceno wrote:
>> From: steve+comp.lang.pyt...@pearwood.info Subject: Re: Short-circuit
>> Logic
>> Date: Fri, 31 May 2013 05:13:51 + To: python-list@python.org
>>
>> On Fri, 31 May 2013 00:03:13 +0300, Carlos Nepomuceno wrote:
From: steve+com
1 - 100 of 13783 matches
Mail list logo