Steven D'Aprano writes:
> The most conservative approach is to assume that while you're suspended,
> *everything else* is suspended too, so when you resume you still have to
> sleep for the full N seconds.
That's an intriguing interpretation of what sleep() should do, but I
fail to see *how* the
telnetgm...@gmail.com writes:
> Why the following code gives me errors??? And why the print statement run 2
> times? I'll be appreciated your helps, thanks,
> addrnum_dict = {'a':1,'b':2}
> def orderaddrtimes():
> global addrnum_dict
> print type(addrnum_dict)
>
> addrnum_dict = sorte
suyash@gmail.com writes:
> Hello All,
>
> I have installed pyxnat on my mac. With pyxnat i am trying to access XNAT
> server in our university. As mentioned on the tutorial i tried both ways,
> neither is working. Following error is displayed:
>
central=Interface(server='http://hd-hni-x
On Friday, December 5, 2014 2:56:50 PM UTC+8, telne...@gmail.com wrote:
> Why the following code gives me errors??? And why the print statement run 2
> times? I'll be appreciated your helps, thanks,
> addrnum_dict = {'a':1,'b':2}
> def orderaddrtimes():
> global addrnum_dict
> print type(a
On Friday, December 5, 2014 3:20:14 PM UTC+8, Cameron Simpson wrote:
> On 05Dec2014 15:01, telnetgm...@gmail.com wrote:
> >Why the following code gives me errors??? And why the print statement run 2
> >times? I'll be appreciated your helps, thanks,
> >addrnum_dict = {'a':1,'b':2}
> >def orderaddr
Peter Otten <__pete...@web.de> writes:
> Did you ever hit the "Socialize" button?
No.
> Are you eager to see the latest
> tweets when you are reading a PEP?
No.
> Do you run away screaming from a page
> where nothing moves without you hitting a button?
No, I like pages where I am in control
On Fri, 05 Dec 2014 15:01:51 +0800, telnetgm...@gmail.com wrote:
> Why the following code gives me errors??? And why the print statement run 2
> times? ...
> addrnum_dict = {'a':1,'b':2}
> def orderaddrtimes():
> global addrnum_dict
> print type(addrnum_dict)
>
> addrnum_dict = sorte
On 05Dec2014 15:01, telnetgm...@gmail.com wrote:
Why the following code gives me errors??? And why the print statement run 2
times? I'll be appreciated your helps, thanks,
addrnum_dict = {'a':1,'b':2}
def orderaddrtimes():
global addrnum_dict
print type(addrnum_dict)
addrnum_dict = so
Why the following code gives me errors??? And why the print statement run 2
times? I'll be appreciated your helps, thanks,
addrnum_dict = {'a':1,'b':2}
def orderaddrtimes():
global addrnum_dict
print type(addrnum_dict)
addrnum_dict = sorted(addrnum_dict.iteritems(), key=lambda d:d[1],
Why the following code gives me errors??? And why the print statement run 2
times? I'll be appreciated your helps, thanks,
addrnum_dict = {'a':1,'b':2}
def orderaddrtimes():
global addrnum_dict
print type(addrnum_dict)
addrnum_dict = sorted(addrnum_dict.iteritems(), key=lambda d:d[1],
Steven D'Aprano :
> Unfortunately a lot of systems get that wrong. E.g. I just ran "sleep
> 30" from my Linux shell, immediately paused it using Ctrl-Z, waited a
> couple of minutes, and used fg to continue. It returned immediately.
>
> Why is this behaviour wrong?
I think the #1 thing is to spec
On 12/04/2014 11:46 PM, C. Ng wrote:
Hi,
Given the sample text file below (where the gibberish represent the irrelevant
portions) :
abcddsdfffgfg
ggfhghghgfhghgh round 5 xccdcxcfd
sdfdffdfbcvcvbbvnghg score = 0.4533
abcddsdfffgfg round 5 level = 0.15
ggfhghghgfhghgh round 10 dfsdf
Steven D'Aprano writes:
> LJ wrote:
>
> > def gt(l):
> >a["1"] = a["1"] | set([l])
>
> The difference between this example and your second one:
>
> > def gt2(l):
> >b=b+l
>
>
> is that the second is a "binding operation" and the first is not.
I disagree; they're both binding operations (
On 12/04/2014 09:54 PM, Steven D'Aprano wrote:
Dave Angel wrote:
On 12/04/2014 07:39 PM, Steven D'Aprano wrote:
Marko Rauhamaa wrote:
So, if I call
time.sleep(86400)
and the program is suspended for 24 hours, should time.sleep() return
right after it is resumed or after another 24 hours?
> On Dec 4, 2014, at 8:56 PM, Dennis Lee Bieber wrote:
>
> On Thu, 04 Dec 2014 14:51:14 +0200, Marko Rauhamaa
> declaimed the following:
>
>> Chris Angelico :
>>
>>> A lot of programs don't use threads, and therefore cannot have thread
>>> safety problems - or, looking at it the other way, do
On 12/04/2014 08:46 PM, C. Ng wrote:
Hi,
Given the sample text file below (where the gibberish represent the irrelevant
portions) :
abcddsdfffgfg
ggfhghghgfhghgh round 5 xccdcxcfd
sdfdffdfbcvcvbbvnghg score = 0.4533
abcddsdfffgfg round 5 level = 0.15
ggfhghghgfhghgh round 10 dfsdf
Hi,
Given the sample text file below (where the gibberish represent the irrelevant
portions) :
abcddsdfffgfg
ggfhghghgfhghgh round 5 xccdcxcfd
sdfdffdfbcvcvbbvnghg score = 0.4533
abcddsdfffgfg round 5 level = 0.15
ggfhghghgfhghgh round 10 dfsdfdcdsd
sdfdffdfbcvcvbbvnghg score = 0.4
Dave Angel wrote:
> On 12/04/2014 07:39 PM, Steven D'Aprano wrote:
>> Marko Rauhamaa wrote:
>>
>>> So, if I call
>>>
>>> time.sleep(86400)
>>>
>>> and the program is suspended for 24 hours, should time.sleep() return
>>> right after it is resumed or after another 24 hours?
>>
>> If the program is
On 12/04, LJ wrote:
> Hi All,
>
> I have a quick question regarding the modification of global variables within
> functions. To illustrate, consider the following toy example:
>
> a={"1": set()}
> b=9
>
> def gt(l):
>a["1"] = a["1"] | set([l])
>
> When calling this last function and checking t
LJ wrote:
> Hi All,
>
> I have a quick question regarding the modification of global variables
> within functions. To illustrate, consider the following toy example:
>
> a={"1": set()}
> b=9
>
> def gt(l):
>a["1"] = a["1"] | set([l])
The difference between this example and your second one:
On 12/04/2014 07:39 PM, Steven D'Aprano wrote:
Marko Rauhamaa wrote:
So, if I call
time.sleep(86400)
and the program is suspended for 24 hours, should time.sleep() return
right after it is resumed or after another 24 hours?
If the program is suspended, then no time should pass for that prog
On Thu, 04 Dec 2014 16:25:44 +0100, ast wrote:
> There is no roll over problem with time.time() since the very
> first one in planned far in the future, but time.time() can go
> backward when a date update throught NTP server is done.
> time.monotonic() is monotonic but roll over often (every 49.
Marko Rauhamaa wrote:
> So, if I call
>
> time.sleep(86400)
>
> and the program is suspended for 24 hours, should time.sleep() return
> right after it is resumed or after another 24 hours?
If the program is suspended, then no time should pass for that program.
Since sleep() is given in terms of
On Fri, Dec 5, 2014 at 10:54 AM, Dave Angel wrote:
> Python doesn't have declarations, so when a function is compiled, the
> compiler has to infer what names are to be local and what are not. The rule
> it normally uses is roughly based on whether an assignment occurs somewhere
> inside the funct
On 12/04/2014 03:27 AM, Albert van der Horst wrote:
> That doesn't help. I'm a very experienced programmer and work in
> routinely a dozen languages. Sometimes I do python. I want to do
> numeric work. I remember the name numpy. It is important, everybody
> knows it, it is all over the place. So I
On 12/04/2014 03:09 PM, LJ wrote:
Hi All,
I have a quick question regarding the modification of global variables within
functions. To illustrate, consider the following toy example:
a={"1": set()}
b=9
def gt(l):
a["1"] = a["1"] | set([l])
When calling this last function and checking the
On Fri, Dec 5, 2014 at 10:43 AM, Joseph L. Casale
wrote:
> I found that article before posting and some of the guys here have already
> started using peewee. I don't have much time with it yet. So far all I can say
> is its unfortunate some package authors take such an approach to naming.
>
> I ca
> Anything listed here http://www.pythoncentral.io/sqlalchemy-vs-orms/
> you've not heard about? I found peewee easy to use although I've
> clearly no idea if it suits your needs. There's only one way to find out :)
Hi Mark,
I found that article before posting and some of the guys here have alre
On Fri, Dec 5, 2014 at 10:20 AM, Joseph L. Casale
wrote:
> I am stuck with the current architecture, but the idea you propose has
> been thrown around, truth is I am not certain if we are enduring the
> effort of such a large rewrite that Python is the tool to use (this is a
> Windows application)
On Thu, Dec 4, 2014 at 6:27 PM, Albert van der Horst <
alb...@spenarnc.xs4all.nl> wrote:
> In article ,
> Joel Goldstick wrote:
>
>
> Plain google is far superior in finding information.
>
> And you tell me that writing yet another tutorial would improve that?
> No, there is just one way. The p
On 04/12/2014 23:20, Joseph L. Casale wrote:
First recommendation: Less layers. Instead of SQLAlchemy, just import
sqlite3 and use it directly. You should be able to switch out "import
sqlite as db" for "import psycopg2 as db" or any other Python DB API
module, and still have most/all of the bene
> First recommendation: Less layers. Instead of SQLAlchemy, just import
> sqlite3 and use it directly. You should be able to switch out "import
> sqlite as db" for "import psycopg2 as db" or any other Python DB API
> module, and still have most/all of the benefit of the extra layer,
> without any e
Ian Kelly :
> It's not clear to me whether those cases are relevant to the rollover
> concern anyway. I wouldn't be shocked if the GetTickCount() function
> simply stopped increasing while the system is suspended, since after
> all it's not "ticking" during that time.
So, what's the semantics of
On Fri, Dec 5, 2014 at 9:10 AM, Wolfgang Maier
wrote:
> which I read as there has been a stepwise transition between 2.5 and 2.7 so
> that 2.7 now behaves like Python 3 even without the __future__ statement.
> OTOH, I believe you, of course, if you're saying implicit relative imports
> are working
On Thu, Dec 4, 2014 at 1:24 PM, Akira Li <4kir4...@gmail.com> wrote:
>
> Ian Kelly writes:
> > This seems like a lot of effort to unreliably design around a problem
that
> > will matter to only a tiny fraction of users.
>
> - people's computers are mostly on batteries (laptops, tablets,
> smartp
On 04.12.2014 22:30, Chris Angelico wrote:
On Fri, Dec 5, 2014 at 7:56 AM, Wolfgang Maier
wrote:
On 04.12.2014 19:05, Chris Angelico wrote:
With os.path it definitely is. With the actual code in question, it's
a Python 2.7 project that mostly uses relative imports - inside
package.module1 is
On Fri, Dec 5, 2014 at 7:56 AM, Wolfgang Maier
wrote:
> On 04.12.2014 19:05, Chris Angelico wrote:
>>
>>
>> With os.path it definitely is. With the actual code in question, it's
>> a Python 2.7 project that mostly uses relative imports - inside
>> package.module1 is "import module2" etc - and I wa
On 04.12.2014 19:05, Chris Angelico wrote:
With os.path it definitely is. With the actual code in question, it's
a Python 2.7 project that mostly uses relative imports - inside
package.module1 is "import module2" etc - and I was writing an
external script that calls on one of the modules.
What
Chris Angelico :
> Even when I do suspend a VM, I often terminate applications in it, and
> just use suspension to save having to boot the OS every time.
One interesting detail is DHCP leases.
When it is resumed from suspension, a linux computer thinks it still has
the old IP address, which migh
Greetings
My name is Amrish and I'm an IT Recruiter at Talented IT. Our records show
that you are an experienced IT professional with experience relevant to one of
my current contract openings. The job is located in Redmond, WA with one of our
Fortune 100 client. They are looking for SR. S
On Fri, Dec 5, 2014 at 7:24 AM, Akira Li <4kir4...@gmail.com> wrote:
>> This seems like a lot of effort to unreliably design around a problem that
>> will matter to only a tiny fraction of users.
>
> - people's computers are mostly on batteries (laptops, tablets,
> smartphones) -- "suspended from
Ian Kelly writes:
> On Thu, Dec 4, 2014 at 11:09 AM, Marko Rauhamaa wrote:
>>
>> Chris Angelico :
>>
>> > It's not a Python issue. Python can't do anything more than ask the
>> > system, and if the system's value rolls over several times a year,
>> > Python can't magically cure that. The informa
On Thu, Dec 4, 2014 at 1:09 PM, LJ wrote:
>
> Hi All,
>
> I have a quick question regarding the modification of global variables
within functions. To illustrate, consider the following toy example:
>
> a={"1": set()}
> b=9
>
> def gt(l):
>a["1"] = a["1"] | set([l])
>
> When calling this last f
On Fri, Dec 5, 2014 at 7:09 AM, LJ wrote:
> def gt(l):
>a["1"] = a["1"] | set([l])
>
>
> def gt2(l):
>b=b+l
These two may both look like they're assigning something, but one of
them is assigning directly to the name "b", while the other assigns to
a subscripted element of "a". In the firs
Hi All,
I have a quick question regarding the modification of global variables within
functions. To illustrate, consider the following toy example:
a={"1": set()}
b=9
def gt(l):
a["1"] = a["1"] | set([l])
When calling this last function and checking the a dictionary, I get:
>>> gt(5)
>>> a
On 12/4/2014 11:46 AM, Aseem Bansal wrote:
Yeah, the problem seems to be with registry as every solution seems
to be fiddling with registry.
One can edit the registry directly with regedit. If you try it, follow
the instruction to first make a backup. Look for a regedit tutorial on
the web.
On Fri, Dec 5, 2014 at 5:44 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> ... what you said There's no way to guarantee to keep calling the
>> function. You have to depend on upstream.
>
> The caveats I listed are real concerns for the modern-day programmer.
> However, they are of a different
On Thu, 04 Dec 2014 00:02:25 +0100, Skybuck Flying wrote:
> "Mark Lawrence" wrote in message
> news:mailman.16534.1417610132.18130.python-l...@python.org...
>
> On 03/12/2014 02:27, Skybuck Flying wrote:
>> Excuse is: "bad programming style".
>>
>> I don't need snot telling me how to program aft
On Thu, 4 Dec 2014 20:22:11 +0100 (CET), Jean-Michel Pichavant
wrote:
>- Original Message -
>> From: "Seymore4Head"
>> To: python-list@python.org
>> Sent: Friday, 28 November, 2014 4:31:50 AM
>> Subject: Re: Can you use self in __str__
>>
>> On Thu, 27 Nov 2014 21:49:29 -0500, Dave Ange
Peter Otten <__pete...@web.de> writes:
> Did you ever hit the "Socialize" button? Are you eager to see the latest
> tweets when you are reading a PEP? Do you run away screaming from a page
> where nothing moves without you hitting a button? Do you appreciate the
> choice between ten or so links
On Thu, Dec 4, 2014 at 11:09 AM, Marko Rauhamaa wrote:
>
> Chris Angelico :
>
> > It's not a Python issue. Python can't do anything more than ask the
> > system, and if the system's value rolls over several times a year,
> > Python can't magically cure that. The information has already been
> > lo
- Original Message -
> From: "Seymore4Head"
> To: python-list@python.org
> Sent: Friday, 28 November, 2014 4:31:50 AM
> Subject: Re: Can you use self in __str__
>
> On Thu, 27 Nov 2014 21:49:29 -0500, Dave Angel
> wrote:
>
> class Hand:
> def __init__(self):
> self.hand = []
Hello All,
I have installed pyxnat on my mac. With pyxnat i am trying to access XNAT
server in our university. As mentioned on the tutorial i tried both ways,
neither is working. Following error is displayed:
>>> central=Interface(server='http://hd-hni-xnat.cac.cornell.edu:8443/xnat')
User: sdb
Chris Angelico :
> ... what you said There's no way to guarantee to keep calling the
> function. You have to depend on upstream.
The caveats I listed are real concerns for the modern-day programmer.
However, they are of a different nature than the complaint against
time.monotonic().
Marko
--
On Fri, Dec 5, 2014 at 5:14 AM, Joseph L. Casale
wrote:
> Begrudgingly, I need to migrate away from SQLAlchemy onto a
> package that has fast imports and very fast model build times.
>
> I have a less than ideal application that uses Python as a plugin
> interpreter which is not performant in this
On Fri, Dec 5, 2014 at 5:09 AM, Marko Rauhamaa wrote:
> Sure it could by having an invisible background thread occasionally call
> time.monotonic(). It could even be done on the side without a thread.
No, it can't be solved by anything in that process, because...
> * the program could be stoppe
On 12/04/2014 09:09 AM, Peter Otten wrote:
>
> Did you ever hit the "Socialize" button? Are you eager to see the latest
> tweets when you are reading a PEP? Do you run away screaming from a page
> where nothing moves without you hitting a button? Do you appreciate the
> choice between ten or so
Begrudgingly, I need to migrate away from SQLAlchemy onto a
package that has fast imports and very fast model build times.
I have a less than ideal application that uses Python as a plugin
interpreter which is not performant in this use case where its
being invoked freshly several times per operat
Chris Angelico :
> It's not a Python issue. Python can't do anything more than ask the
> system, and if the system's value rolls over several times a year,
> Python can't magically cure that. The information has already been
> lost.
Sure it could by having an invisible background thread occasiona
On Fri, Dec 5, 2014 at 4:36 AM, Jean-Michel Pichavant
wrote:
> I know you specifically stated you didn't want to do this but
>
> import os
>
> os.path.isfile()
>
> is the best option imo, especially from the reader point of view ("Namespaces
> are one honking great idea").
With os.path it defini
On 12/03/2014 03:02 AM, Chris Angelico wrote:
>
> Throughout the code, I want to refer to "path.split()",
> "path.isfile()", etc, without the "os." in front of them. I could do
> either of these:
>
> import os.path as path
> from os import path
>
> Which one would you recommend? Does it depend o
On 12/04/2014 09:36 AM, Jean-Michel Pichavant wrote:
>
> I know you specifically stated you didn't want to do this but
>
> import os
>
> os.path.isfile()
>
> is the best option imo, especially from the reader point of view ("Namespaces
> are one honking great idea").
But, "Flat is better
- Original Message -
> From: "Chris Angelico"
> To: python-list@python.org
> Sent: Wednesday, 3 December, 2014 12:02:17 PM
> Subject: Style question: Importing modules from packages - 'from' vs 'as'
>
> When importing a module from a subpackage, it's sometimes convenient
> to refer to it
On 12/03/2014 12:02 PM, Chris Angelico wrote:
When importing a module from a subpackage, it's sometimes convenient
to refer to it throughout the code with a one-part name rather than
two. I'm going to use 'os.path' for the examples, but my actual
use-case is a custom package where the package nam
On 04 Dec 2014 09:48:49 GMT
alb...@spenarnc.xs4all.nl (Albert van der Horst) wrote:
> In article <546d7505$0$12899$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
> >And the award for the most gratuitous comments before an import goes to
> >one of my (former) workmates, who wrote t
Did you ever hit the "Socialize" button? Are you eager to see the latest
tweets when you are reading a PEP? Do you run away screaming from a page
where nothing moves without you hitting a button? Do you appreciate the
choice between ten or so links to the documentation?
You can probably guess m
On Thu, Dec 4, 2014, at 10:50, Marko Rauhamaa wrote:
> That is, the internal integer wrap is not guarded against between the
> calls to time.monotonic(), maybe.
Looking at the code, it looks like it does guard against the rollover,
though if you let your program run for 49.7 days _without_ calling
Yeah, the problem seems to be with registry as every solution seems to be
fiddling with registry.
I know that reinstalling OS is a really bad idea. But I have tried to find a
way to solve this for months now. I have started a bounty on superuser also for
the same in the question "Python IDLE di
On Fri, Dec 5, 2014 at 3:21 AM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> The implication is that if you go more than 49 days without calling
>> the function on old Windows systems, rollovers could be missed, which
>> is good to know about.
>
> The implication is all but clear, but that was my susp
Ian Kelly :
> The implication is that if you go more than 49 days without calling
> the function on old Windows systems, rollovers could be missed, which
> is good to know about.
The implication is all but clear, but that was my suspicion. It would be
so bad that the documentation should be much
On Fri, Dec 5, 2014 at 3:05 AM, Ian Kelly wrote:
> On Dec 4, 2014 8:56 AM, "Marko Rauhamaa" wrote:
>>
>> "ast" :
>>
>> > Does any body know when time.monotonic() rolls over ?
>>
>> Never, according to the documentation you linked.
>>
>> Admittedly, the documentation confuses the reader by chattin
On Dec 4, 2014 8:56 AM, "Marko Rauhamaa" wrote:
>
> "ast" :
>
> > Does any body know when time.monotonic() rolls over ?
>
> Never, according to the documentation you linked.
>
> Admittedly, the documentation confuses the reader by chatting about some
> irrelevant internal Windows details.
Not ent
I wish him all the luck while having sleep deprivation trying to solve
production issues :)
On Thu, Dec 4, 2014 at 7:35 PM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> jtan wrote:
>
> > How can Skybuck use so much globals. Wouldn't that introduce a lot of
> > thread safety pr
"ast" :
> Does any body know when time.monotonic() rolls over ?
Never, according to the documentation you linked.
Admittedly, the documentation confuses the reader by chatting about some
irrelevant internal Windows details.
Also, the tone of the documentation raises a suspicion that this code
m
On 12/4/2014 5:35 AM, Albert van der Horst wrote:
I agree that it is a useful function and that it is doing
the right thing. What is wrong is the name.
I refer to the fact that it is not returning the maximum.
It returns the iterator value that leads to the maximum.
A function that doesn't retur
On Wed, Dec 3, 2014 at 5:28 AM, Gregory Ewing
wrote:
>
> Kasper Peeters wrote:
>>
>> That may have been the design plan, but in Python 2.7.6, I definitely
>> am able to inject locals via PyEval_GetLocals() and have them be visible
>> both from the C and Python side;
>
> What seems to be happening
Hello,
Does any body know when time.monotonic() rolls over ?
On python doc https://docs.python.org/3/library/time.html
it is said every 49.7 days on Windows versions older than
Vista. For more recent Windows, it is sais that monotonic()
is system-wide but they dont say anything about roll ov
Many years ago I, too, had a couple of CS profs who forced us to include too
many (usually innocuous) comments in our Fortran and PL/1 code. Perhaps they
were trying to counter the natural programmer tendency of not commenting at all?
Forty years of programming later (yikes!), I try to use comm
On Thu, Dec 4, 2014, at 05:09, Albert van der Horst wrote:
> So in that case max doesn't return the maximum (True), but instead
> something else.
If you want to find the "largest" item in a list of of strings, sorted
case-insensitively, you might use str.lower or locale.strxfrm as the key
function
- Original Message -
> From: sohcahto...@gmail.com
> I was trying to illustrate the point that some professors would
> demand you write code like this...
>
> # increment the line count
> lineCount += 1
>
> # Check if line count is over 10
> if lineCount > 10
> # Tell the user there ar
Hi
I'm trying to install the path.py package under Python 2.7 on Windows.
I installed it using:
easy_install path.py
That worked but it didn't install path.py which is needed by my PTVS IDE for
code completion (Intellisense).
I then tried downloading path.py-7.0.zip. I unzipped it and ran:
p
Steven D'Aprano writes:
> Jussi Piitulainen wrote:
>
> > Would you also want sorted called something else when used with a
> > key? Because it doesn't produce a sorted list of the keys either:
> >
> > >>> data = ("short", "long", "average")
> > >>> sorted(data, key=len)
> > ['long', 'short
Chris Angelico :
> A lot of programs don't use threads, and therefore cannot have thread
> safety problems - or, looking at it the other way, do not care about
> thread safetiness. It's like having Neil Armstrong wear water wings to
> make sure he won't drown in the Sea of Tranquility.
The water
Albert van der Horst wrote:
> I agree that it is a useful function and that it is doing
> the right thing. What is wrong is the name.
> I refer to the fact that it is not returning the maximum.
> It returns the iterator value that leads to the maximum.
That is incorrect. It returns the maximum va
Jussi Piitulainen wrote:
> Would you also want sorted called something else when used with a key?
> Because it doesn't produce a sorted list of the keys either:
>
> >>> data = ("short", "long", "average")
> >>> sorted(data, key=len)
> ['long', 'short', 'average']
> >>> max(data, key=len)
Albert van der Horst wrote:
> That doesn't help. I'm a very experienced programmer and work in
> routinely a dozen languages. Sometimes I do python. I want to do
> numeric work. I remember the name numpy. It is important, everybody
> knows it, it is all over the place. So I want to find its docs,
jtan wrote:
> How can Skybuck use so much globals. Wouldn't that introduce a lot of
> thread safety problems?
Of course it would. But I expect that Skybuck probably doesn't even know
what threads are. Or if he does, he probably doesn't believe that they
should be used.
Thread safety is just the
Albert van der Horst wrote:
> I agree that it is a useful function and that it is doing
> the right thing. What is wrong is the name.
> I refer to the fact that it is not returning the maximum.
> It returns the iterator value that leads to the maximum.
> A function that doesn't return a maximum sho
Albert van der Horst wrote:
> In article ,
> Peter Otten <__pete...@web.de> wrote:
>>Albert van der Horst wrote:
>>
>>> In the Rosetta code I come across this part of
>>> LU-decomposition.
>>>
>>> def pivotize(m):
>>> """Creates the pivoting matrix for m."""
>>> n = len(m)
>>> ID = [[
Albert van der Horst writes:
> Chris Angelico wrote:
> > If there's no clear maximum, it can't do any better than
> > that. It's still returning something for which there is no
> > greater.
>
> I agree that it is a useful function and that it is doing
> the right thing. What is wrong is the name.
Albert van der Horst writes:
> Useful as that function [Python's max with a key] may be, it
> shouldn't have been called max.
The meaning of the key should be added to help(max), if it still isn't
- "returns a maximal element or an element that maximizes the key".
In some communities they call i
In article ,
Chris Angelico wrote:
>On Thu, Dec 4, 2014 at 9:09 PM, Albert van der Horst
> wrote:
>>>If there is more than one item with the maximum calculated the first is
>>>given, so for your attempt
>>>
>>>max(xrange(100,200), key=lambda i: i%17==0 )
>>
>>>
>>>the values False, False, True, F
On Thu, Dec 4, 2014 at 9:27 PM, Albert van der Horst
wrote:
> That doesn't help. I'm a very experienced programmer and work in
> routinely a dozen languages. Sometimes I do python. I want to do
> numeric work. I remember the name numpy. It is important, everybody
> knows it, it is all over the pla
In article ,
Joel Goldstick wrote:
>
>Or just WOW!. Programming is hard, and people have just started to do
>it. Fifty years isn't that long. It has only been 20 years or so
>that the web has been around. That makes it easier to find
>information from a variety or sources -- the official doc
On Thu, Dec 4, 2014 at 4:03 PM, jtan wrote:
> How can Skybuck use so much globals. Wouldn't that introduce a lot of thread
> safety problems?
A lot of programs don't use threads, and therefore cannot have thread
safety problems - or, looking at it the other way, do not care about
thread safetines
On 04/12/2014 05:03, jtan wrote:
How can Skybuck use so much globals. Wouldn't that introduce a lot of
thread safety problems?
I actually don't know. However buying very strong thread from your
local store and making sure that you have a very sharp needle does help
alleviate threading safet
On Thu, Dec 4, 2014 at 9:09 PM, Albert van der Horst
wrote:
>>If there is more than one item with the maximum calculated the first is
>>given, so for your attempt
>>
>>max(xrange(100,200), key=lambda i: i%17==0 )
>
>>
>>the values False, False, True, False, ... are calculated and because
>>
>
How can Skybuck use so much globals. Wouldn't that introduce a lot of
thread safety problems?
On Thu, Dec 4, 2014 at 9:32 AM, Mark Lawrence
wrote:
> On 03/12/2014 23:02, Skybuck Flying wrote:
>
>>
>>
>> "Mark Lawrence" wrote in message
>> news:mailman.16534.1417610132.18130.python-l...@python.o
In article ,
Peter Otten <__pete...@web.de> wrote:
>Albert van der Horst wrote:
>
>> In the Rosetta code I come across this part of
>> LU-decomposition.
>>
>> def pivotize(m):
>> """Creates the pivoting matrix for m."""
>> n = len(m)
>> ID = [[float(i == j) for i in xrange(n)] for j in
Dan Stromberg wrote:
> 1) writing in Cython+CPython (as opposed to wrapping C++ with Cython)
That is an option, but it locks the code to Cython and CPython forever. C
and C++ are at least semi-portable.
> 2) using numba+CPython (It's a pretty fast decorator - I've heard it's
> faster than Cytho
1 - 100 of 103 matches
Mail list logo