Re: [Python-Dev] PEP 465: A dedicated infix operator for matrix multiplication

2014-04-10 Thread Björn Lindqvist
2014-04-09 17:37 GMT+02:00 Nathaniel Smith n...@pobox.com: On Wed, Apr 9, 2014 at 4:25 PM, Björn Lindqvist bjou...@gmail.com wrote: 2014-04-08 14:52 GMT+02:00 Nathaniel Smith n...@pobox.com: On Tue, Apr 8, 2014 at 9:58 AM, Björn Lindqvist bjou...@gmail.com wrote: 2014-04-07 3:41 GMT+02:00

Re: [Python-Dev] PEP 465: A dedicated infix operator for matrix multiplication

2014-04-09 Thread Björn Lindqvist
2014-04-08 14:52 GMT+02:00 Nathaniel Smith n...@pobox.com: On Tue, Apr 8, 2014 at 9:58 AM, Björn Lindqvist bjou...@gmail.com wrote: 2014-04-07 3:41 GMT+02:00 Nathaniel Smith n...@pobox.com: So, I guess as far as I'm concerned, this is ready to go. Feedback welcome: http://legacy.python.org

Re: [Python-Dev] PEP 465: A dedicated infix operator for matrix multiplication

2014-04-08 Thread Björn Lindqvist
variables H, beta, r and V are. And why import solve when you aren't using it? Curious readers that aren't very good at matrix math, like me, should still be able to follow your logic. Even if it is just random data, it's better than nothing! -- mvh/best regards Björn Lindqvist

Re: [Python-Dev] PEP 465: A dedicated infix operator for matrix multiplication

2014-04-08 Thread Björn Lindqvist
2014-04-08 12:23 GMT+02:00 Sturla Molden sturla.mol...@gmail.com: Björn Lindqvist bjou...@gmail.com wrote: import numpy as np from numpy.linalg import inv, solve # Using dot function: S = np.dot((np.dot(H, beta) - r).T, np.dot(inv(np.dot(np.dot(H, V), H.T)), np.dot(H, beta) - r

Re: [Python-Dev] Retrieve an arbitrary element from asetwithoutremoving it

2009-11-09 Thread Björn Lindqvist
2009/11/6 Raymond Hettinger pyt...@rcn.com: [me] Why not write a short, fast get_first() function for your utils directory and be done with it? That could work with sets, mappings, generators, and other containers and iterators. No need to fatten the set/frozenset API for something so

Re: [Python-Dev] please consider changing --enable-unicode default to ucs4

2009-09-29 Thread Björn Lindqvist
2009/9/28 James Y Knight f...@fuhm.net: People building their own Python version will usually also build their own extensions, so I don't really believe that the above scenario is very common. I'd just like to note that I've run into this trap multiple times. I built a custom python, and

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-17 Thread BJörn Lindqvist
It's not only about what people find intuitive. Why care about them? Most persons aren't programmers. It is about what application developers find useful too. I have often needed to calculate month deltas according to the proposal. I suspect many other programmers have too. Writing a month add

Re: [Python-Dev] Proposal: add odict to collections

2008-06-14 Thread BJörn Lindqvist
On Sat, Jun 14, 2008 at 11:39 PM, Armin Ronacher [EMAIL PROTECTED] wrote: Some reasons why ordered dicts are a useful feature: And for metaclasses or for LRU caches or for removing duplicates in a list while maintaining order. I think that the name ordereddict would be more readable though, and

Re: [Python-Dev] urllib exception compatibility

2007-09-27 Thread BJörn Lindqvist
On 9/27/07, Guido van Rossum [EMAIL PROTECTED] wrote: How about making IOError, OSError and EnvironmentError all aliases for the same thing? The distinction is really worthless historical baggage. Wouldn't it also be nice to have some subclasses of IOError like FileNotFoundError,

Re: [Python-Dev] [Python-3000] Documentation switch imminent

2007-08-17 Thread BJörn Lindqvist
It is fantastic! Totally super work. I just have one small request; pretty please do not set the font. I'm very happy with my browsers default (Verdana), and Bitstream Vera Sans renders badly for me. -- mvh Björn ___ Python-Dev mailing list

[Python-Dev] Patch reviews

2007-06-06 Thread BJörn Lindqvist
Here is a review of some patches: * [ 1673759 ] '%G' string formatting doesn't catch same errors as '%g' This patch is done, has been reviewed and works as advertised. Just needs someone to commit it I think. * [ 1100942 ] datetime.strptime constructor added Doesn't apply cleanly, emits

Re: [Python-Dev] Minor ConfigParser Change

2007-06-05 Thread BJörn Lindqvist
On 6/1/07, Fred L. Drake, Jr. [EMAIL PROTECTED] wrote: Changes in general are a source of risk; they have to be considered carefully. We've seen too many cases in which a change was thought to be safe, but broke something for someone. Avoiding style-only changes helps avoid introducing

[Python-Dev] What exception should Thread.start() raise?

2007-06-04 Thread BJörn Lindqvist
The threading module contains buggy code: class Thread(_Verbose): ... def start(self): assert self.__initialized, Thread.__init__() not called assert not self.__started, thread already started ... If you run such code with python -O, weird stuff may happen when you

Re: [Python-Dev] The docs, reloaded

2007-05-24 Thread BJörn Lindqvist
On 5/24/07, Greg Ewing [EMAIL PROTECTED] wrote: Talin wrote: As in the above example, the use of backticks can be signal to the document processor that the enclosed text should be examined for identifiers and other Python syntax. Does this mean it's time for pyST -- Python-structured

Re: [Python-Dev] The docs, reloaded

2007-05-22 Thread BJörn Lindqvist
IMO that pair of examples shows clearly that, in this application, reST is not an improvement over LaTeX in terms of readability/ writability of source. It's probably not worse, although I can't help muttering EIBTI. In particular I find the ``'...'`` construct horribly unreadable

Re: [Python-Dev] The docs, reloaded

2007-05-22 Thread BJörn Lindqvist
In your examples, I think the ReST version can be cleaned up quite a bit. First by using the .. default-role:: literal directive so that you can type `foo()` instead of using double back quotes and then you can remove the redundant semantic markup. Like this: I've already assigned the

Re: [Python-Dev] functools additions

2007-04-15 Thread BJörn Lindqvist
def cat(x): return x def multimap(func, s, n=2): assert n 0, n must be positive return (map(func, seq) if n == 1 else map(lambda x: multimap(func, x, n-1), seq)) def multifilter(func, s, n=2): return multimap(lambda x: filter(func,

Re: [Python-Dev] concerns regarding callable() method

2007-04-08 Thread BJörn Lindqvist
On 4/8/07, Paul Pogonyshev [EMAIL PROTECTED] wrote: I have no problems with Python being untyped. But I want that error stack traces provide some useful information as possible with reasonable effort and that errors happen as early as possible. In particular, stack trace should mention that

Re: [Python-Dev] Proposal to revert r54204 (splitext change)

2007-03-14 Thread BJörn Lindqvist
On 3/14/07, Phillip J. Eby [EMAIL PROTECTED] wrote: At 06:47 PM 3/14/2007 +0100, Martin v. Löwis wrote: Phillip J. Eby schrieb: This backwards-incompatible change is therefore contrary to policy and should be reverted, pending a proper transition plan for the change (such as

Re: [Python-Dev] datetime module enhancements

2007-03-11 Thread BJörn Lindqvist
On 3/11/07, Steven Bethard [EMAIL PROTECTED] wrote: On 3/11/07, Christian Heimes [EMAIL PROTECTED] wrote: I've another idea. Date and datetime objects are compared by date. The date object for a given date is always smaller than the datetime for the same day - even for midnight. I really

Re: [Python-Dev] datetime module enhancements

2007-03-09 Thread BJörn Lindqvist
On 3/9/07, Guido van Rossum [EMAIL PROTECTED] wrote: On 3/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The range of datetime objects far exceeds that of the current Unix timestamp. Given that the range of current (32-bit) Unix timestamps is approximately 1970 to 2038, What would the

Re: [Python-Dev] datetime module enhancements

2007-03-09 Thread BJörn Lindqvist
On 3/9/07, Guido van Rossum [EMAIL PROTECTED] wrote: On 3/9/07, BJörn Lindqvist [EMAIL PROTECTED] wrote: On 3/9/07, Guido van Rossum [EMAIL PROTECTED] wrote: On 3/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The range of datetime objects far exceeds that of the current Unix

[Python-Dev] Italic text in the manual

2007-03-08 Thread BJörn Lindqvist
(This might be a silly question..) In the dev stdlib reference there are lots of pages in which all text is in italics. Such as all chapters after chapter 18. Is it supposed to be that way? It looks quite ugly. -- mvh Björn ___ Python-Dev mailing list

Re: [Python-Dev] PEP 364, Transitioning to the Py3K standard library

2007-03-07 Thread BJörn Lindqvist
When Python's import machinery is initialized, the oldlib package is imported. Inside oldlib there is a class called ``OldStdlibLoader``. This class implements the PEP 302 interface and is automatically instantiated, with zero arguments. The constructor reads all the ``.mv`` files from the

Re: [Python-Dev] New syntax for 'dynamic' attribute access

2007-02-12 Thread BJörn Lindqvist
Is even more syntactic sugar really what Python really needs? -- mvh Björn ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 355 status

2006-10-29 Thread BJörn Lindqvist
On 10/28/06, Talin [EMAIL PROTECTED] wrote: BJörn Lindqvist wrote: I'd like to write a post mortem for PEP 355. But one important question that haven't been answered is if there is a possibility for a path-like PEP to succeed in the future? If so, does the path-object implementation have

Re: [Python-Dev] PEP 355 status

2006-10-24 Thread BJörn Lindqvist
On 10/1/06, Guido van Rossum [EMAIL PROTECTED] wrote: On 9/30/06, Giovanni Bajo [EMAIL PROTECTED] wrote: It would be terrific if you gave us some clue about what is wrong in PEP355, so that the next guy does not waste his time. For instance, I find PEP355 incredibly good for my own path

Re: [Python-Dev] Python Doc problems

2006-09-29 Thread BJörn Lindqvist
If there are rampant criticisms of the Python docs, then those that are complaining should take specific examples of their complaints to the sourceforge bug tracker and submit documentation patches for the relevant sections. And personally, I've not noticed that criticisms of the Python docs

Re: [Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers)

2006-08-02 Thread BJörn Lindqvist
On 8/2/06, M.-A. Lemburg [EMAIL PROTECTED] wrote: Greg Ewing wrote: In all my programming so far I've found numerous uses for round-to-int, and exactly zero uses for round-binary-float-to-decimal- places. So from my point of view, the YAGNI applies to the *current* behavour of round()!

Re: [Python-Dev] Minor: Unix icons for 2.5?

2006-07-11 Thread BJörn Lindqvist
I know the .desktop files have become fairly standard, but are these our responsibility or does that rest with the distributions/integrators? (I'm not objecting, but I'm not sure what the right thing really is since Python is an interpreter, not a desktop application.) The same anal argument

Re: [Python-Dev] Switch statement

2006-06-25 Thread BJörn Lindqvist
On 6/23/06, Edward C. Jones [EMAIL PROTECTED] wrote: Python is a beautiful simple language with a rich standard library. Python has done fine without a switch statement up to now. Guido left it out of the original language for some reason (my guess is simplicity). Why is it needed now? What

Re: [Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses

2006-06-10 Thread BJörn Lindqvist
And from a syntax perspective, it's a bad idea. x[] is much more often a typo than an intentional attempt to index a zero-dimensional array. but how often is it a typo? for example, judging from c.l.python traffic, forgetting to add a return statement is a quite common, but I haven't

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-05-07 Thread BJörn Lindqvist
would have thought that the one obvious way to get rid of the wanky feeling would have been to write: def make_person(name, age, phone, location): ... make_person(name, age, phone, location) This doesn't fly in something like PyGUI, where there are literally dozens of potential

Re: [Python-Dev] PEP 3102: Keyword-only arguments

2006-05-03 Thread BJörn Lindqvist
make_person(=name, =age, =phone, =location) And even with Terry's use case quoted I can't make out what you meant that to do. I meant it to do the same thing as make_person(name=name, age=age, phone=phone, location=location) I come across use cases for this fairly frequently,

Re: [Python-Dev] Python 3000 Process

2006-03-20 Thread BJörn Lindqvist
Please don't respond with answers to these questions -- each of them is worth several threads. Instead, ponder them, and respond with a +1 or -1 on the creation of the python-3000 mailing list. We'll start discussing the issues there -- or here, if the general sense is not to split the list.

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread BJörn Lindqvist
do { cmd = readline() do_stuff_with_cmd(cmd); } while (!strcmp(cmd, quit)); printf(Bye!); exit(0); KISS? -- mvh Björn ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Path PEP and the division operator

2006-02-04 Thread BJörn Lindqvist
On 2/4/06, Guido van Rossum [EMAIL PROTECTED] wrote: I won't even look at the PEP as long as it uses / or // (or any other operator) for concatenation. That's good, because it doesn't. :) http://www.python.org/peps/pep-0355.html -- mvh Björn ___

Re: [Python-Dev] The path module PEP

2006-02-01 Thread BJörn Lindqvist
I've submitted an updated version of the PEP. The only major change is that instead of the method atime and property getatime() there is now only one method named atime(). Also some information about the string inheritance problem in Open Issues. I still have no idea what to do about it though.

Re: [Python-Dev] Path inherits from string

2006-01-27 Thread BJörn Lindqvist
[M.-A. Lemburg] I don't see why this is critical for the success of the Path object. I agree with Thomas that interfaces should be made compatible to Path object. See the steps I mentioned. Unless step #1 is completed there is no way to make the following code work: open(Path(foobar))

[Python-Dev] Path inherits from string

2006-01-26 Thread BJörn Lindqvist
This seems to be the only really major issue with the PEP. Everything else is negotiable, IMHO. But the string inheritance seem to be such a critical issue it deserves its own thread. I have tried to address all criticism of it here: Really, it is the same arguments that have been rehashed over

Re: [Python-Dev] / as path join operator (was: Re: The path module PEP)

2006-01-26 Thread BJörn Lindqvist
I think that everything that can be said aboud __div__() has already been said. But this argument was really convincing: [Tony Meyer] The vast majority of people (at least at the time) were either +0 or -0, not +1. +0's are not justification for including something. There is no clear

Re: [Python-Dev] The path module PEP

2006-01-25 Thread BJörn Lindqvist
My comments on the issues. It was easier this way than trying to reply on every message individually. Inheritance from string (Jason) This issue has been brought up before when people were discussing the path module. I think the consensus is that, while the inheritance isn't pure, practicality

Re: [Python-Dev] New Pythondoc by effbot

2006-01-23 Thread BJörn Lindqvist
Have you studied wikipedia's approach? It's multi-layered and worth learning from (start with their FAQ on editing). (And by the way, I am *not* advocating writing the docs as one big wikipedia -- only the user commentary.) to clarify, I'm advocating maintaining the docs via a

Re: [Python-Dev] Should the default equality operator compare values instead of identities?

2005-11-07 Thread BJörn Lindqvist
How would the value equality operator deal with recursive objects? class Foo: def __init__(self): self.foo = self Seems to me that it would take atleast some special-casing to get Foo() == Foo() to evalute to True in this case... -- mvh Björn

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-30 Thread BJörn Lindqvist
I did this for my favorite proposal, and ended up with the list shown further down below. I think they all looks great! The fact that so few were found in whole of the standard library does put the use case into question, though, no? Though I am sure more could be found with a more

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-21 Thread BJörn Lindqvist
I think I'd prefer (if expr then expr else expre) i.e. no colons. My problem with this syntax is that it can be hard to read: return if self.arg is None then default else self.arg looks worryingly like return NAME NAME.NAME NAME NAME NAME NAME NAME NAME.NAME That can already be

Re: [Python-Dev] and and or operators in Py3.0

2005-09-20 Thread BJörn Lindqvist
While you're at it, maybe we should switch to and || as well? That's another thing I always mistype when switching between languages... You're joking, surely? for Python 3000, I'd recommend switching to and then and or else instead of the current ambiguous single-keyword versions.

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-01 Thread BJörn Lindqvist
Something I've noticed from teaching C++ to newbies, is that you should NOT (never ever) start with cout Hello, world! endl;. You should start with printf(Hello, world\n); The cout thingy is impossible to explain to a newbie because it uses much underlying magic and has a very different

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread BJörn Lindqvist
I like partition() but maybe even better would be if strings supported slicing by string indices. key, sep, val = 'foo = 32'.partition('=') would be: key, val = 'foo = 32'[:'='], 'foo = 32'['=':] To me it feels very natural to extend Python's slices to string indices and would cover most of

Re: [Python-Dev] Chaining try statements: eltry?

2005-07-11 Thread BJörn Lindqvist
I surely find them useful, and see them as a Python originality (a welcome one). They are indeed an original invention. (One day I looked at the similarity between if and while and noticed that there was a use case for else after while too.) The question remains whether Python would be

Re: [Python-Dev] Propose to reject PEP 313 -- Adding Roman Numeral Literals to Python

2005-06-18 Thread BJörn Lindqvist
*cough* Would it also be possible for the PEP-maintainers not to accept PEPs that are obvious jokes unless thedate is April I? *uncough* -- mvh Bjrn ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] Wishlist: dowhile

2005-06-14 Thread BJörn Lindqvist
do: block until cond Written like this it is not very obvious that the 'unil' is part of the do-until suite. I also imagine it to be difficult to parse and it breaks the rule that suites end when there is a dedentation. So, IMHO using an indented 'until' is the least evil of a

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread BJörn Lindqvist
In contrast, the dowhile solution only takes about 30 seconds to get used to. Maybe that idea should follow the path of the genexp PEP, get rejected now, and then get resurrected as a bright idea two years from now. Or maybe not. nothing about foo here dowhile foo != 42: 10 lines of

Re: [Python-Dev] Wishlist: dowhile

2005-06-13 Thread BJörn Lindqvist
do: body until cond But I'm sure that has problems too. [Raymond Hettinger] That looks nice to me. [Nick Coghlan] And this could easily be extended to allow code both before and after the 'until', giving a fully general loop: do:

Re: [Python-Dev] PEP 340: Only for try/finally?

2005-05-03 Thread BJörn Lindqvist
Guido How many try/finally statements have you written inside a loop? Guido In my experience this is extrmely rare. I found no Guido occurrences in the standard library. [Skip again] How'd we start talking about try/finally? Because it provides by far the dominant use

Re: [Python-Dev] anonymous blocks

2005-04-19 Thread BJörn Lindqvist
RSMotD (random stupid musing of the day): so I wonder if the decorator syntax couldn't be extended for this kind of thing. @acquire(myLock): code code code Would it be useful for anything other than mutex-locking? And wouldn't it be better to make a function of the block

Re: [Python-Dev] Adding any() and all()

2005-03-11 Thread BJörn Lindqvist
Not sure this is pertinent but anyway: any and all are often used as variable names. all especially often and then almost always as a list of something. It would not be good to add all to the list of words to watch out for. Also, all is usually thought of as a list of (all) things. In my mind it

Re: [Python-Dev] LinkedHashSet/LinkedHashMap equivalents

2005-03-10 Thread BJörn Lindqvist
I would LOVE for **kwargs to be an ordered dict. It would allow me to write code like this: .class MyTuple: .def __init__(self, **kwargs): .self.__dict__ = ordereddict(kwargs) . .def __iter__(self): .for k, v in self.__dict__.items(): .yield v . .t = MyTuple(r