On Thu, Jan 8, 2015 at 6:13 PM, Rustom Mody wrote:
> With that I came up with the expression
>
> transpose(array([list(roll(mat[:,i],i,0)) for i in range(mat.shape[1])]))
>
> Not exactly pretty.
> My hunch is it can be improved??...
Hmm, you could use the column_stack constructor to avoid having
On Thu, Jan 8, 2015 at 7:07 PM, Chris Angelico wrote:
> On Fri, Jan 9, 2015 at 12:46 PM, Steven D'Aprano
>> The fallback rule I use when float('nan') fails is
>>
>> INF = 1e3000 # Hopefully, this should overflow to INF.
>> NAN = INF-INF # And this hopefully will give a NaN.
>
> The first
On Fri, Jan 9, 2015 at 6:14 AM, Gisle Vanem wrote:
> Why are these listed twice with different casing? One
> would assume that Python on Win32 would be case-insensitive.
> Some .pth-file to blame here?
I checked my own Python 2.7 installation and discovered that I have
the same problem, although
On Fri, Jan 9, 2015 at 2:24 PM, Gisle Vanem wrote:
> Ian Kelly wrote:
>
>> I checked my own Python 2.7 installation and discovered that I have
>> the same problem, although without the different casing. Perusing the
>> .pth files in site-packages turns up setuptools.pth
On Fri, Jan 9, 2015 at 2:26 PM, Albert-Jan Roskam
wrote:
>
>
> Hi,
>
> I am trying to write a class decorator that checks whether deprecated
> parameters with non-default
>
> arguments are used. More complete code is here: http://pastebin.com/ZqnMis6M.
> In the code below,
>
> how should I modif
On Fri, Jan 9, 2015 at 12:24 PM, Dom wrote:
> Hi
>
> I'm trying to return a simple array of numbers from a package using cx_oracle
> (5.1.2). I believe this is possible. I've not been able to find anything that
> suggest it isn't
I'm afraid I don't have an answer for you, but you would probably
On Sun, Jan 11, 2015 at 3:13 PM, Jenacee Owens wrote:
> I'm new to python and every time i type a command into the MS-DOS Commands it
> looks like this.
>
strings
>
> Tracebackfile "";line 1 in
> name error:name strings'is not defined
That error is from the Python interpreter, not MS-DO
On Sun, Jan 11, 2015 at 10:31 PM, Steven D'Aprano wrote:
> But bizarrely, you can import os.path this way!
>
> py> import os.path
> py> os.path
>
> py> os.__package__
> ''
>
>
>
> By what wizardry does this work?
By the wizardry of adding an entry to sys.modules.
https://hg.python.org/cpython/f
On Jan 12, 2015 6:47 AM, "Albert-Jan Roskam" wrote:
> Thanks for your replies. I changed it into a regular decorator (not a class
> decorator). It would have been even nicer if I only needed to specify it once
> per class, but, well, in my case this hardly matters. The code below works as
> int
On Mon, Jan 12, 2015 at 9:16 PM, Andrew Robinson
wrote:
> Instead of pretending what if -- let's actually REPLACE python's built in
> bool class with an emulation that ALLOWS subclassing and THEN let's TEST my
> hypothesis that the assert statement you gave me can't tell the difference
> between b
On Tue, Jan 13, 2015 at 4:20 AM, Chris Angelico wrote:
> On Tue, Jan 13, 2015 at 10:00 PM, Marko Rauhamaa wrote:
>> The code above, though, shouldn't consume memory since it is a simple
>> tail-recursive loop.
>
> Only if the interpreter can optimize it away. Bear in mind that it
> doesn't _retur
On Tue, Jan 13, 2015 at 10:02 AM, Jean-Baptiste Braun
wrote:
> Hi,
>
> I'm working on auto-generated python code with the exec function. I've done
> some performance benches :
>
> % python -m timeit '1 + 1'
> 1000 loops, best of 3: 0.0229 usec per loop
>
> % python -m timeit "exec('1 + 1')"
>
On Tue, Jan 13, 2015 at 5:12 PM, Andrew Robinson
wrote:
> So -- even a cursory thought shows that the information could be encoded in
> a very few lines even without an instance of a subclass:
>
> class CAllFalse():
> @classmethod
> def __nonzero__(Kls): return False
>
> class CPartFalse()
On Wed, Jan 14, 2015 at 9:45 AM, jason wrote:
> class A(object):
> def __init__(self, s):
> self.s = s
> def foo(self, s):
> return A(s)
Instead of explicitly naming the return class here, do this:
return self.__class__(s)
Alternatively, since you never u
On Wed, Jan 14, 2015 at 2:02 AM, Jean-Baptiste Braun
wrote:
> What I don't understand is the ratio between test 2 / 4 and test 1 / 3.
>
> Let 0.0229 sec be the execution time to read a bytecode (1st test).
> Executing two times that bytecode takes 0.042 sec (test 3), which looks
> coherent.
>
> Le
On Wed, Jan 14, 2015 at 8:00 PM, Andrew Robinson
wrote:
> Hi Ian,
> On 01/14/2015 12:31 AM, Ian Kelly wrote:
>
> On Tue, Jan 13, 2015 at 5:12 PM, Andrew Robinson
> wrote:
>
> So -- even a cursory thought shows that the information could be encoded in
> a very few lines
On Wed, Jan 14, 2015 at 6:26 PM, Steven D'Aprano
wrote:
> Any other differences?
Objects of classic builtin types don't even have the __class__ attribute.
>>> type(A)
>>> A.__class__
Traceback (most recent call last):
File "", line 1, in
AttributeError: class A has no attribute '__class__'
>
On Wed, Jan 14, 2015 at 11:06 PM, Steven D'Aprano wrote:
> I have a function, which I put into an expression like this:
>
> def func(a, b=None):
> global spam
> import math
> spam = [a, b]*3
> print spam
> del spam
>
>
> value = [1, "hello", int, func]
> del func
>
> How would
On Thu, Jan 15, 2015 at 12:23 AM, Andrew Robinson
wrote:
> Can you name any other language that *does* allow subclassing of
> booleans or creation of new boolean values?
>
> Yes. Several off the top of my head -- and I have mentioned these before.
> They generally come with the extra subclasses pr
On Thu, Jan 15, 2015 at 6:45 PM, Andrew Robinson
wrote:
> Then I look at python development historically and look at the built in
> class's return values for compares; and I notice; they have over time become
> more and more tied to the 'type' bool. I expect sometime in the future that
> python m
On Thu, Jan 15, 2015 at 9:00 PM, Chris Angelico wrote:
> My first response was going to be "Well, you can always add another
> layer of indirection to try to solve your problem", but then I went
> and looked up builders on Wikipedia. Now I'm confused. What can you do
> with a builder that you can'
On Sat, Jan 17, 2015 at 7:26 AM, Steven D'Aprano
wrote:
> I don't understand why they add the error tolerances together. I can
> understand taking the minimum, or the maximum:
The usual idea is that the tolerance is calculated as a relative
value, but an absolute tolerance is used instead when th
On Sat, Jan 17, 2015 at 8:09 PM, Steven D'Aprano
wrote:
> I'm guessing that can only have come from the mindset of C/C++ programmers,
> where this sort of thing is considered acceptable:
Maybe. The journal reference in the second link I posted dates the
practice back to at least 1975, a time pred
On Tue, Jan 20, 2015 at 6:33 AM, Rustom Mody wrote:
> from enum import Enum
> class TreeTag(Enum):
> I = 0 # An internal node
> L = 1 # A leaf node
> def __repr__(self): return self.name
>
> I = TreeTag.I
> L = TreeTag.L
Explicitly tagging nodes as internal or leaves is kind of ugl
On Wed, Jan 21, 2015 at 7:47 AM, Steven D'Aprano
wrote:
>> More irksome that for the second we've to preface with
>>
>> from collections import Counter
>>
>> And still more a PITA that a straightforward standard name like bag (or
>> multiset) is called by such an ungoogleable misleading name as co
On Wed, Jan 21, 2015 at 9:15 AM, Ian Kelly wrote:
> class MultiSet(MutableSet):
In retrospect this probably shouldn't derive from MutableSet, since
that carries the expectation that all elements are unique (much like
how bool shouldn't be subclassed). For instance, collections.Set
On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote:
> The Haskell is bullseye¹ in capturing the essense of a tree because
> conceptually a tree of type t is recursive in the sense that it can contain
> 2 subtrees -- (B x lst rst) -- or its a base case -- L x.
How do you create a tree containing a
On Wed, Jan 21, 2015 at 11:56 PM, Ian Kelly wrote:
> Since each element is associated with a node, the question could
> equally be phrased as "How do you create a tree containing an even
> number of elements under this constraint?"
Of course I meant to write "nod
On Wed, Jan 21, 2015 at 10:20 PM, Rustom Mody wrote:
> On Thursday, January 22, 2015 at 4:25:03 AM UTC+5:30, Ian wrote:
>> On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote:
>> > The Haskell is bullseye¹ in capturing the essense of a tree because
>> > conceptually a tree of type t is recursive in
On Thu, Jan 22, 2015 at 10:13 AM, Automn wrote:
> The graphics have been licensed for this.
Really? I'm surprised Square-Enix would even give consideration to
licensing something like this.
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Jan 22, 2015 at 7:16 AM, Steven D'Aprano
wrote:
>> Meanwhile, there's the strange decision to implement type hints for
>> local variables # comment lines. I have an hard time wrapping my head
>> around this one. Really, comments!?
>
> Yes, really. There is plenty of prior art for machine-m
On Thu, Jan 22, 2015 at 2:56 PM, Emile van Sebille wrote:
> I've been lightly scanning and following the PEP 484 discussion, and one
> point I don't think I've seen mentioned is how you might hint a function
> that accepts different types, eg:
>
> def adder(a,b): return a+b
>
> This is one of the
On Thu, Jan 22, 2015 at 3:08 PM, Ian Kelly wrote:
> On Thu, Jan 22, 2015 at 2:56 PM, Emile van Sebille wrote:
>> I've been lightly scanning and following the PEP 484 discussion, and one
>> point I don't think I've seen mentioned is how you might hint a function
&
On Thu, Jan 22, 2015 at 3:27 PM, Chris Kaynor wrote:
> Or use Any, which is basically the same thing:
>
> def adder(a: Any, b: Any) -> Any:
> return a + b
Yeah, but this just seems like extra noise since it's not going to
help the type checker at all.
--
https://mail.python.org/mailman/listi
On Thu, Jan 22, 2015 at 7:59 PM, Rustom Mody wrote:
> PS Ian for a hot thread like this its good to put quotes carefully
> You are quoting Steven quoting somebody -- dunno who that somebody is
I include quote that only for context to Steven's quote. Since I'm not
replying to it, I don't care who
On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody wrote:
> Can you tell me what of the following code does not satisfy your requirements?
> [Needs python 3.4]
>
>
from enum import IntEnum
class B4(IntEnum):
> F1 = 0
> F2 = 0
> F3 = 0
> T = 1
This strikes me a
On Fri, Jan 23, 2015 at 4:46 AM, Andrew Robinson
wrote:
> Although, I have to laugh -- Verilog can syntheze a CPU -- implement memory
> -- and then load a program and run python on the virtual machine. When the
> pentium was first developed, I watched as Intel actually booted up MS-DOS
> under u
On Fri, Jan 23, 2015 at 10:03 AM, Rustom Mody wrote:
> On Friday, January 23, 2015 at 10:22:06 PM UTC+5:30, Ian wrote:
>> On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody wrote:
>> > Can you tell me what of the following code does not satisfy your
>> > requirements?
>> > [Needs python 3.4]
>> >
>> >
On Fri, Jan 23, 2015 at 10:45 AM, Rustom Mody wrote:
> No disagreement with the 'hack'
> As for "no use case for equal but distinct tokens" - thats a strange
> view given this thread
If you want equal but distinct, you can give them distinct values and
define an __eq__ method that compares them a
On Fri, Jan 23, 2015 at 11:23 AM, Automn wrote:
> On 2014-03-10, Virgil Stokes wrote:
>> [SNIP]
>
> I don't think you understand what Mr. Otten said, it is not undefined
> behaviour,
> maybe you could demangle your import statement.
The post you're replying to is 10 months old. One way or anoth
On Sat, Jan 24, 2015 at 2:14 PM, Mario Figueiredo wrote:
> In article <54c39366$0$13006$c3e8da3$54964...@news.astraweb.com>,
> steve+comp.lang.pyt...@pearwood.info says...
>> > AttributeError: 'Sub' instance has no attribute '__bases__',
>> > AttributeError: 'foo' object has no att
On Sat, Jan 24, 2015 at 2:14 PM, alister
wrote:
>>
>> Either that, or make up change with 20¢, 10¢ and 5¢ (we practice
>> round-to-nearest-5-cents here).
>
> I suppose if you all pay 35¢ it at least gives the waitress a tip.
"""
In the Pacific States they have made a bolder push for complexity,
On Sat, Jan 24, 2015 at 3:02 PM, Mario Figueiredo wrote:
> In article ,
> tjre...@udel.edu says...
>>
>> > "__main__"
>> > from module import a_name
>>
>> A module is a namespace associating names with objects. This statememt
>> says to import the a_name to object association from modul
On Jan 25, 2015 2:37 PM, "Terry Reedy" wrote:
> 2. the second array is a compact array of entries in insertion order,
such as
>
> [hash, ptr to 'x', ptr to 23]
> [hash, ptr to 'colour', ptr to 'red']
> [hash, ptr to the string 'y', ptr to the int 42]
>
> Iteration would use the compact
On Mon, Jan 26, 2015 at 8:50 AM, Adam Funk wrote:
> On 2015-01-26, Peter Otten wrote:
>
>> Adam Funk wrote:
>>
>>> On 2015-01-09, Ned Batchelder wrote:
for b in options.bar or ():
do_stuff(b)
>>>
>>> Do you mean "for b in options.bar or []:" ?
>>
>> Doesn't matter; in the c
On Mon, Jan 26, 2015 at 10:18 AM, Mark Lawrence wrote:
> IIRC, and probably from this list, creating tuples is way faster than
> creating lists, but accessing items is slower. Can anybody confirm this for
> us?
The first seems to be true as long as the tuples are small.
$ python3 -m timeit 't =
On Mon, Jan 26, 2015 at 11:23 AM, Ian Kelly wrote:
> $ python3 -m timeit 't = (1000, 2000, 3000)'
> 1 loops, best of 3: 0.0147 usec per loop
> $ python3 -m timeit 't = [1000, 2000, 3000]'
> 1000 loops, best of 3: 0.0678 usec per loop
> $ pytho
On Jan 26, 2015 6:42 AM, "Andrew Robinson" wrote:
> ...
If you're going to descend into insults and name-calling, then I'm not
going to waste any more of my time on this thread. The restriction on
inheriting from bool isn't likely to change. There have been several
suggestions as to how you can d
On Mon, Jan 26, 2015 at 4:47 PM, Andrew Robinson
wrote:
> Hmmm That's not much different than the tuple object I made as a
> container and which Ian complained about. In fact, you did overload the
> comparison operators, just like I did...
Yeah, I know I said I was done with this thread, bu
On Tue, Jan 27, 2015 at 4:22 PM, Salem Alqahtani wrote:
> I appreciate your answers and the output that I am expected from my simple
> code is the following:
>
> ['salem','Ali','sultan']
> ['salem','sultan','Ali']
> ['Ali','sultan','salem']
> ['Ali','salem','sultan']
> ['sultan','Ali','salem']
>
On Tue, Jan 27, 2015 at 5:17 PM, Mario Figueiredo wrote:
> In article ,
> n...@nedbatchelder.com says...
>> What does "participate in OOP" mean?
>
> Means the object is capable of participating in inheritance and/or
> polymorphism. An instance of an object is capable of doing so, per its
> class d
On Wed, Jan 28, 2015 at 8:04 AM, Mario Figueiredo wrote:
> In article <54c83ab4$0$12982$c3e8da3$54964...@news.astraweb.com>,
> steve+comp.lang.pyt...@pearwood.info says...
>>
>> Mario Figueiredo wrote:
>>
>> > Static analysis cannot and should not clutter executable code.
>>
>> (1) It isn't clutte
On Wed, Jan 28, 2015 at 11:53 AM, jesse wrote:
> should not it be 1<<32 -1(4g)?
>
> normal zip archive format should be able to support 4g file.
Bugs can be filed at http://bugs.python.org/
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Jan 29, 2015 at 12:16 AM, Steven D'Aprano
wrote:
> Besides, descriptors are
> handled by the metaclass, so we could write a metaclass that doesn't handle
> them.
Maybe this doesn't affect your argument, but they're actually handled
by the class's __getattribute__, not by the metaclass.
>
On Thu, Jan 29, 2015 at 1:34 AM, Mario Figueiredo wrote:
> In article <54c980cd$0$12981$c3e8da3$54964...@news.astraweb.com>,
> steve+comp.lang.pyt...@pearwood.info says...
>>
>> Ian, that's obvious. Just open your eyes:
>>
>> Scala
>> def addInt( a:Int, b:Int ) : Int
>>
>> Python
>> def addInt( a:
On Wed, Jan 28, 2015 at 5:55 PM, jesse wrote:
> the official zip format spec states clearly that normal zip file should be
> <= 4G size instead 2G. I just can not believe Python has such an obvious
> bug.
>
> People suggested monkey patch the ZIP64_LIMIT value to pass 2G, I am not
> sure what wil
On Wed, Jan 28, 2015 at 2:36 PM, Chris Angelico wrote:
> On Thu, Jan 29, 2015 at 5:53 AM, jesse wrote:
>> should not it be 1<<32 -1(4g)?
>>
>> normal zip archive format should be able to support 4g file.
>>
>> thanks
>
> 1<<31-1 is the limit for a signed 32-bit integer. You'd have to look
> into
On Thu, Jan 29, 2015 at 12:12 PM, jesse wrote:
>
> On Jan 29, 2015 9:27 AM, "Ian Kelly" wrote:
>>
>> On Wed, Jan 28, 2015 at 2:36 PM, Chris Angelico wrote:
>> > On Thu, Jan 29, 2015 at 5:53 AM, jesse wrote:
>> >> should not it be 1<<32
On Thu, Jan 29, 2015 at 10:32 AM, Tim Chase
wrote:
> On 2015-01-29 17:17, Mark Lawrence wrote:
>> The author is quite clear on his views here
>> https://realpython.com/blog/python/the-most-diabolical-python-antipattern/
>> but what do you guys and gals think?
>
> I just read that earlier today and
On Thu, Jan 29, 2015 at 11:16 PM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> At least use "except Exception" instead of a bare except. Do you
>> really want things like SystemExit and KeyboardInterrupt to get turned
>> into 0?
>
> How about:
>
On Fri, Jan 30, 2015 at 2:02 AM, Marko Rauhamaa wrote:
> Mark Lawrence :
>
>> On 30/01/2015 06:16, Marko Rauhamaa wrote:
>>> How about:
>>>
>>> ==
>>> try:
>>> do_interesting_stuff()
>>> except ValueError:
>>> try:
>>> log_it()
>
On Fri, Jan 30, 2015 at 3:00 AM, Marko Rauhamaa wrote:
> Marko Rauhamaa :
>
Surprisingly this variant could raise an unexpected exception:
==
try:
do_interesting_stuff()
except ValueError:
try:
On Fri, Jan 30, 2015 at 8:30 AM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> The bare raise re-raises the most recent exception that is being
>> handled. The "raise e" raises that exception specifically, which is
>> not the most recent in the case of a secondary
I just tried to use the password recovery tool for the Python tracker.
I entered my personal email. It sent me the confirmation email with
the password reset link, which I followed. It then reset my password
and sent an email to a different address, an old work address that I
no longer have, so I h
On Fri, Jan 30, 2015 at 9:09 AM, Robert Chen wrote:
> how to parse sys.argv as dynamic parameters to another function?
>
>
> fun(sys.argv)
>
> in perl, this is very easy. please help.
Do you mean that you want each item of sys.argv to be passed as a
separate parameter to the function? If so, then
On Fri, Jan 30, 2015 at 8:56 AM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> Like I suggested earlier, just don't catch the inner exception at all.
>> The result will be both exceptions propagated, chained in the proper
>> order.
>
> Depends on the situation.
Lik
On Fri, Jan 30, 2015 at 11:45 AM, Paul Moore wrote:
> 2. Because on Windows I'd have to use threads, whereas asyncio uses IO
> completion ports behind the scenes (I think) which are probably a lot more
> lightweight.
I have no idea whether that's true, but note that add_reader() on
Windows doe
On Fri, Jan 30, 2015 at 11:42 AM, Mario Figueiredo wrote:
> To be clear, type declarations in Julia, Scala, C have the potential to
> produce side-effects, can result in optimized code and can result in
> compile time errors or warnings. They also affect runtime evaluation as
> you could easily at
On Sun, Feb 1, 2015 at 9:55 AM, Steven D'Aprano
wrote:
> Steven D'Aprano wrote:
>
>> len tries to call __len__ if it exists, and if not, it tries walking the
>> iterable counting items.
>
> Hmmm, I may have mis-remembered that. Perhaps I'm thinking of Ruby.
I think you just got it backward. iter
On Sat, Jan 31, 2015 at 7:38 PM, Jason Friedman wrote:
>> I have two lists
>>
>> l1 = ["a","b","c","d","e","f","g","h","i","j"]
>> l2 = ["aR","bR","cR"]
>>
>> l2 will always be smaller or equal to l1
>>
>> numL1PerL2 = len(l1)/len(l2)
>>
>> I want to create a dictionary that has key from l1 and v
On Sun, Feb 1, 2015 at 11:49 AM, Mark Lawrence wrote:
> On 01/02/2015 18:14, Grant Edwards wrote:
>> A loop containing 1 line of code will execute in the same abount of
>> time as that loop with 1 line of code and 99 blanks lines.
>>
>> The latter loop is running at 100 times as many lines/second
On Mon, Feb 2, 2015 at 4:26 PM, Luke Lloyd wrote:
> I am in school and there is a problem with my code:
>
>
>
> When I try to run my code in the python code in the python shell it waits
> about 10 seconds then shows an error that says “IDLE’s subprocess didn’t
> make connection. Either IDLE can’t
On Mon, Feb 2, 2015 at 4:26 PM, Luke Lloyd wrote:
> I am in school and there is a problem with my code:
>
>
>
> When I try to run my code in the python code in the python shell it waits
> about 10 seconds then shows an error that says “IDLE’s subprocess didn’t
> make connection. Either IDLE can’t
On Tue, Feb 3, 2015 at 10:40 AM, Steven D'Aprano
wrote:
> AT LONG LAST THE LIGHT DAWNS! THE PENNY DROPS!
Careful there, you're starting to sound like Ranting Rick. ;-)
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Feb 4, 2015 at 6:23 AM, Neal Becker wrote:
> class rpt:
> def __init__ (self, value, rpt):
> self.value = value; self.rpt = rpt
> def __call__ (self):
> for i in range (self.rpt):
> yield self.value
Note that this class is just reimplementing itertools.repeat.
>>> list(
On Wed, Feb 4, 2015 at 9:50 AM, Travis Griggs wrote:
> I really like pymongo. And I really like Python. But one thing my fingers
> really get tired of typing is
>
> someDoc[‘_’id’]
>
> This just does not roll of the fingers well. Too many “reach for modifier
> keys” in a row. I would rather use
On Wed, Feb 4, 2015 at 1:16 PM, Travis Griggs wrote:
> Yes, that is clever. So if you wanted to minimize the amount of typing you
> had to do at all of your pymongo API call sites, what strategy would you use
> to keep that relatively terse?
>
> Is the following the right approach to take?
>
> c
On Wed, Feb 4, 2015 at 1:16 PM, Travis Griggs wrote:
> Yes, that is clever. So if you wanted to minimize the amount of typing you
> had to do at all of your pymongo API call sites, what strategy would you use
> to keep that relatively terse?
>
> Is the following the right approach to take?
>
> c
On Wed, Feb 4, 2015 at 3:38 PM, Steven D'Aprano
wrote:
> Travis Griggs wrote:
>> This just does not roll of the fingers well. Too many “reach for modifier
>> keys” in a row.
>
> *One* modifier key in a row is too many?
>
> s o m e SHIFT D o c [ ' SHIFT _ i d ' ]
I think the point was meant to be
On Thu, Feb 5, 2015 at 2:40 AM, Steven D'Aprano
wrote:
> Devin Jeanpierre wrote:
>
>> On Wed, Feb 4, 2015 at 1:18 PM, Chris Angelico wrote:
>>> On Thu, Feb 5, 2015 at 4:36 AM, Peter Otten <__pete...@web.de> wrote:
Another alternative is to put a list literal on the lefthand side:
>>
On Thu, Feb 5, 2015 at 12:25 PM, Paul Moore wrote:
> On Thursday, 5 February 2015 16:57:07 UTC, Rob Gaddi wrote:
>> You don't need the whole scipy stack, numpy will let you do everything
>> you want. The trick to working in numpy is to parallelize your problem;
>> you don't do a thing a thousan
On Thu, Feb 5, 2015 at 6:27 AM, Anssi Saari wrote:
> What I find surprising is that so many people cling so hard to their
> localized keyboard layouts. I think none of those were created by
> engineers and should be avoided by technical people. Or, in fact,
> everyone. Even Microsoft seems to unde
On Fri, Feb 6, 2015 at 7:55 AM, Neal Becker wrote:
> Trying out pypeg2. The below grammar is recursive. A 'Gen' is an ident
> followed by parenthesized args. args is a csl of alphanum or Gen.
>
> The tests 'p' and 'p2' are fine, but 'p3' fails
> SyntaxError: expecting u')'
>
>
> from __future__
On Fri, Feb 6, 2015 at 11:49 AM, C Smith wrote:
> On Fri, Feb 6, 2015 at 10:20 AM, Chris Angelico wrote:
>> On Sat, Feb 7, 2015 at 3:34 AM, C Smith wrote:
>>> ImportError:
>>> dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so,
>>> 2
On Sat, Feb 7, 2015 at 5:45 PM, Albert van der Horst
wrote:
> It is too bad `` -> '' as a token is now taken.
> I wanted to propose to replace the ternary syntax
> lambda .. : ..
> by a regular operator
> .. -> ..
> then we could have
> x -> x**2
> instead of
> lambda x : x**2
Well, I don't th
On Mon, Feb 9, 2015 at 1:37 PM, Brian wrote:
> Zach,
>
> Here is what I get on the Mac:
>
> $ python3 -c "import token;print(token.__file__)"
> /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/token.py
Are you running this from the same directory where you have your test
scripts (i
On Mon, Feb 9, 2015 at 2:37 PM, Brian wrote:
> Thank you, Ian and Zack! That was exactly the issue. Apparently, having a
> token.py script (one of my first Python 2 scripts to get an authorization
> token from a billing server) is OK for Python 2 but breaks Python 3.
Local modules that have the
On Mon, Feb 9, 2015 at 4:30 PM, Steven D'Aprano
wrote:
> The way you write iterators is like this:
>
>
> Method 1 (the hard way):
>
> - Give your class an __iter__ method which simply returns self:
>
> def __iter__(self):
> return self
>
> - Give your class a __next__ method (`next` in
On Mon, Feb 9, 2015 at 5:59 PM, Chris Kaynor wrote:
> On Mon, Feb 9, 2015 at 4:42 PM, Steven D'Aprano
> wrote:
>> so that's an excellent sign that doing so is best practice, but it should
>> not be seen as *required*. After all, perhaps you have good reason for
>> wanting your iterable class to o
On Tue, Feb 10, 2015 at 9:44 AM, Ethan Furman wrote:
> On 02/09/2015 08:46 PM, Chris Angelico wrote:
>>
>> class Grid:
>> blah blah
>>
>> def __iter__(self):
>> for row in range(self._rows):
>> for col in range(self._cols):
>> if self._grid[row][col]:
>>
On Tue, Feb 10, 2015 at 4:38 PM, wrote:
> I defined function Fatalln in "mydef.py" and it works fine if i call it from
> "mydef.py", but when i try to call it from "test.py" in the same folder:
> import mydef
> ...
> Fatalln "my test"
> i have NameError: name 'Fatalln' is not defined
> I also tr
On Wed, Feb 11, 2015 at 2:48 PM, Mark Lawrence wrote:
> On 11/02/2015 20:02, Hrvoje Nikšić wrote:
>>
>> According to the documentation of the "g" floating-point format,
>> trailing zeros should be stripped from the resulting string:
>>
>> """
>> General format. For a given precision p >= 1, this r
On Wed, Feb 11, 2015 at 3:19 PM, Ian Kelly wrote:
> On Wed, Feb 11, 2015 at 2:48 PM, Mark Lawrence
> wrote:
>> On 11/02/2015 20:02, Hrvoje Nikšić wrote:
>>>
>>> According to the documentation of the "g" floating-point format,
>>> trailing z
On Wed, Feb 11, 2015 at 7:06 PM, Terry Reedy wrote:
>> I can't see why the parser would understand more easily
>>
>> def f(x):
>> return x**2
>> than
>>
>> f = x->
>> return x**2
>
>
> The parser parses both equally well. That is not the issue.
The compiler could at some point recogniz
On Wed, Feb 11, 2015 at 8:56 PM, Chris Angelico wrote:
> On Thu, Feb 12, 2015 at 1:57 PM, Ian Kelly wrote:
>> The reason I don't like this replacing def isn't because the name is
>> necessarily lost. It's because the lack of the well-defined def
>> statement
On Thu, Feb 12, 2015 at 9:45 AM, Gisle Vanem wrote:
> I tried using Interactive Python with a PyQt4 console:
> "IPython.exe qtconsole"
>
> But got a
> "ImportError: IPython requires PyQT4 >= 4.7, found 4.10.4"
>
> Looking at Ipython's check (in site-packages\IPython\external\qt.py):
> if QtC
On Thu, Feb 12, 2015 at 10:19 AM, Skip Montanaro
wrote:
> I believe this sort of lexicographical comparison wart is one of the reasons
> the Python-dev gang decided that there would be no micro versions > 9. There
> are too many similar assumptions about version numbers out in the real
> world.
I
On Thu, Feb 12, 2015 at 11:58 AM, MRAB wrote:
> On 2015-02-12 17:35, Ian Kelly wrote:
>>
>> On Thu, Feb 12, 2015 at 10:19 AM, Skip Montanaro
>> wrote:
>>>
>>> I believe this sort of lexicographical comparison wart is one of the
>>> reasons
>&g
On Thu, Feb 12, 2015 at 1:23 PM, Hrvoje Nikšić wrote:
>> > from decimal import Decimal as D
>> > x = D(1)/D(999)
>> > '{:.15g}'.format(x)
>> >>
>> >> '0.00100100100100100'
> [...]
>> > I'd say it's a bug. P is 15, you've got 17 digits after the decimal place
>> > and two of those are
On Fri, Feb 13, 2015 at 2:26 AM, Hrvoje Nikšić wrote:
> Ian Kelly writes:
>> When you specify the a precision of 15 in your format string, you're
>> telling it to take the first 15 of those. It doesn't care that the
>> last couple of those are zeros, because as
1901 - 2000 of 3558 matches
Mail list logo