Scott W Dunning Wrote in message:
>
Here are the directions Iâm stuck on and what I have so far, Iâll bold the
part
That assumes that people can see which parts of your message are
bold. Rather a poor assumption in a text list like these two
python forums. You should be posting in text,
On Sun, Mar 2, 2014 at 11:16 PM, Westley Martínez wrote:
> I understand that in an object method the first argument in the object
> itself, called self. However, it doesn't have to be called self, and can be
> called anything. So my question is why is it called self and not this like
> from C
On Sun, 02 Mar 2014 22:16:31 -0800, Westley Martínez wrote:
> I understand that in an object method the first argument in the object
> itself, called self. However, it doesn't have to be called self, and
> can be called anything. So my question is why is it called self and not
> this like from C
On Sun, Mar 2, 2014 at 10:44 PM, Chris Angelico wrote:
> Of course, the whole concept depends on being able to use long
> memorable passwords. Any system that sets a maximum password length of
> anything less than about 30-40 characters is causing its users
> problems. There's almost never any rea
Westley MartÃnez Wrote in message:
> I understand that in an object method the first argument in the object
> itself, called self. However, it doesn't have to be called self, and can be
> called anything. So my question is why is it called self and not this like
> from C++ and Java. It's k
I understand that in an object method the first argument in the object itself,
called self. However, it doesn't have to be called self, and can be called
anything. So my question is why is it called self and not this like from C++
and Java. It's kind of a silly question, but one that I'm curi
On Mon, Mar 3, 2014 at 3:38 PM, Steven D'Aprano wrote:
> Oh really? Chances are you're wallet is *full* of pieces of paper that
> people would steal, given half the chance.
Alas no... around here, wallets get filled with pieces of plastic [1],
of which my wallet is sadly devoid. And I can't imagi
On 25/02/2014 8:01 PM, Peter Otten wrote:
alex23 wrote:
No, the _easy_ solution is [find a suitable package on PyPI]
Easy? By the time I have evaluated these I've written my own ;)
It's never writing a solution that's the problem...it's maintaining it
over time :)
--
https://mail.python.o
On Sun, 02 Mar 2014 18:52:40 -0700, Ian Kelly wrote:
> On Sun, Mar 2, 2014 at 6:16 PM, Steven D'Aprano
> wrote:
>> People have managed physical keys for *centuries*. Yes, there are a
>> class of threats where you lose your key, or someone steals it, or
>> makes a copy, but the risks are well-unde
On Mar 2, 2014, at 8:52 PM, Ben Finney wrote:
>
> Once again, Scott, this discussion should be happening at the Tutor
> forum. Please don't continue the fragmentation of this discussion; keep
> the discusson over at the Tutor forum.
Sorry, I was just replying to replies to my post. I get the po
Scott W Dunning writes:
> This is what Im having trouble with now.
Once again, Scott, this discussion should be happening at the Tutor
forum. Please don't continue the fragmentation of this discussion; keep
the discusson over at the Tutor forum.
--
\ “I like to fill my bathtub up with wa
On Mar 2, 2014, at 6:40 PM, Scott W Dunning wrote:
This is what Im having trouble with now. Here are the directions I’m stuck on
and what I have so far, I’ll bold the part that’s dealing with the instructions
if anyone could help me figure out where I’m going wrong.
Thanks!
from random im
On Mon, Mar 3, 2014 at 12:52 PM, Ian Kelly wrote:
> On Sun, Mar 2, 2014 at 6:16 PM, Steven D'Aprano
> wrote:
>> People have managed physical keys for *centuries*. Yes, there are a class
>> of threats where you lose your key, or someone steals it, or makes a
>> copy, but the risks are well-underst
On Sun, Mar 2, 2014 at 6:16 PM, Steven D'Aprano
wrote:
> People have managed physical keys for *centuries*. Yes, there are a class
> of threats where you lose your key, or someone steals it, or makes a
> copy, but the risks are well-understood and can be managed even by your
> grandmother. We have
On Sun, 02 Mar 2014 15:10:06 -0800, Renato wrote:
> I would like to thank every one who posted a reply. I learnt a lot from
> you, guys! I appreciate your attention and your help :)
>
> I took a class on Computer Simulation last year. It was told that
> deterministic (pseudo-)random numbers are e
On Sun, 02 Mar 2014 17:11:19 -0800, Mike wrote:
> without ")" i have the same sintax error:
>
> [root@master ~]# python bkp_db.py
> Traceback (most recent call last):
> File "bkp_db.py", line 19, in
> tar = tarfile.open(dumpfile + '.tar.gz','w:gz')
> TypeError: unsupported operand type(s)
On Mon, 03 Mar 2014 06:14:09 +0700, musicdenotation wrote:
> If Python is not a fnctional language, then which programming paradigmis
> dominant?
Object oriented and procedural are about equally dominant, with a strong
influence from functional paradigm.
There are small amounts of imperative pa
On Sun, 02 Mar 2014 13:33:11 +0200, Marko Rauhamaa wrote:
> Steven D'Aprano :
>
>> On Sun, 02 Mar 2014 11:35:43 +0200, Marko Rauhamaa wrote:
>>> Now, what kinds of object are those constants? We are not supposed to
>>> know or care.
>>
>> Incorrect. We are supposed to know and care.
>
> Then, th
On Sun, Mar 2, 2014 at 4:10 PM, Renato wrote:
> I would like to thank every one who posted a reply. I learnt a lot from you,
> guys! I appreciate your attention and your help :)
>
> I took a class on Computer Simulation last year. It was told that
> deterministic (pseudo-)random numbers are exce
On 02Mar2014 17:55, Ian Kelly wrote:
> On Sun, Mar 2, 2014 at 5:44 PM, Cameron Simpson wrote:
> > Have you considered subclassing memoryview and giving the subclass
> > a __hash__ method?
>
> >>> class MyMemoryView(memoryview):
> ... def __hash__(self): return 42
> ...
> Traceback (most rece
On Mar 1, 2014, at 6:16 PM, Chris Angelico wrote:
>
> Another consideration: Susan's code is written for Python 3, but you
> seemed to be using Python 2. You'll find that the code won't even run
> on your version of Python.
>
> (If you have the chance, ask if the course writer would consider
>
On Mar 2, 2014, at 12:38 AM, Larry Hudson wrote:
>
> Another 'problem' is what you failed to mention in your post, but is apparent
> from the instructions that you posted -- this assignment is NOT the complete
> program, just the beginning of one. Your instructor obviously wants you to
> wor
On Sun, Mar 2, 2014 at 5:07 PM, Juraj Ivančić wrote:
> Is it possible to somehow 'steal' bytearray's buffer and make it a read-only
> bytes? I failed to find a way to do this, and would like to make sure.
>
> My use case is, I would expect, fairly common. I read a certain (potentially
> very large
On 3/2/14 6:14 PM, musicdenotat...@gmail.com wrote:
If Python is not a fnctional language, then which programming paradigmis
dominant?
is_a_functional_language() is not a binary condition, yes or no. It's a
continuum. Python has more functional constructs than Pascal, and fewer
than Haske
On Sun, 02 Mar 2014 15:01:09 -0500, Roy Smith wrote:
> Security is as much about cryptography as it is about human factors and
> business drivers. You can make things resistant to brute-force attacks
> by using longer keys, but people are still going to pick bad passwords.
Yes. But:
> You can f
El domingo, 2 de marzo de 2014 21:38:49 UTC-3, Mike escribió:
> Hello,
>
> I have the script that make a backup file (this process is ok), but now i
> wish compress the file on tar file format. But i have problem syntax in the
> line of the tar function.
>
>
>
> The error is
>
>
>
> [ro
On Sun, Mar 2, 2014 at 5:44 PM, Cameron Simpson wrote:
> Have you considered subclassing memoryview and giving the subclass
> a __hash__ method?
>>> class MyMemoryView(memoryview):
... def __hash__(self): return 42
...
Traceback (most recent call last):
File "", line 1, in
TypeError: type
On 03/03/2014 00:07, Juraj Ivančić wrote:
Is it possible to somehow 'steal' bytearray's buffer and make it a
read-only bytes? I failed to find a way to do this, and would like to
make sure.
My use case is, I would expect, fairly common. I read a certain
(potentially very large) amount of data fr
On 03Mar2014 01:07, Juraj Ivančić wrote:
> Is it possible to somehow 'steal' bytearray's buffer and make it a
> read-only bytes? I failed to find a way to do this, and would like
> to make sure.
>
> My use case is, I would expect, fairly common. I read a certain
> (potentially very large) amount
On Mar 2, 2014 7:41 PM, "Joel Goldstick" wrote:
>
>
> On Mar 2, 2014 7:40 PM, "Mike" wrote:
> >
> > Hello,
> > I have the script that make a backup file (this process is ok), but now
i wish compress the file on tar file format. But i have problem syntax in
the line of the tar function.
> >
> > Th
On Mar 2, 2014 7:40 PM, "Mike" wrote:
>
> Hello,
> I have the script that make a backup file (this process is ok), but now i
wish compress the file on tar file format. But i have problem syntax in the
line of the tar function.
>
> The error is
>
> [root@master ~]# python bkp_db.py
> File "bkp_db
Hello,
I have the script that make a backup file (this process is ok), but now i wish
compress the file on tar file format. But i have problem syntax in the line of
the tar function.
The error is
[root@master ~]# python bkp_db.py
File "bkp_db.py", line 19
tar = tarfile.open(dumpfile)+'
In article ,
Terry Reedy wrote:
> On 3/2/2014 6:14 PM, musicdenotat...@gmail.com wrote:
> > If Python is not a fnctional language, then which programming paradigmis
> > dominant?
>
> Python is an object based procedural language with builtin classes and
> many functional features. Arguing abo
Is it possible to somehow 'steal' bytearray's buffer and make it a
read-only bytes? I failed to find a way to do this, and would like to
make sure.
My use case is, I would expect, fairly common. I read a certain
(potentially very large) amount of data from the network into a
pre-allocated byt
musicdenotat...@gmail.com writes:
> If Python is not a fnctional language, then which programming
> paradigmis dominant?
Python uses a mixture of programming paradigms. Object-oriented,
procedural, functional, and probably some I don't recall.
So it's not accurate to say “Python is not a functio
On 3/2/2014 6:14 PM, musicdenotat...@gmail.com wrote:
If Python is not a fnctional language, then which programming paradigmis
dominant?
Python is an object based procedural language with builtin classes and
many functional features. Arguing about the precise wording of such a
statement is n
On 3/2/2014 6:55 PM, Mark Lawrence wrote:
Trying to install pyttsx, it doesn't strike me as very clever that, as
seen below, you get "Successfully installed pyttsx" despite the syntax
errors and you can't actually do an import.
c:\Users\Mark\CrossCode>c:\Python34\Scripts\pip3.4.exe install pytts
If Python is not a fnctional language, then which programming paradigmis
dominant?
--
https://mail.python.org/mailman/listinfo/python-list
Trying to install pyttsx, it doesn't strike me as very clever that, as
seen below, you get "Successfully installed pyttsx" despite the syntax
errors and you can't actually do an import.
c:\Users\Mark\CrossCode>c:\Python34\Scripts\pip3.4.exe install pyttsx
Downloading/unpacking pyttsx
Download
I would like to thank every one who posted a reply. I learnt a lot from you,
guys! I appreciate your attention and your help :)
I took a class on Computer Simulation last year. It was told that deterministic
(pseudo-)random numbers are excellent for simulations, because they allow
debugging and
Chris Angelico Wrote in message:
>
> }
>
> so in that case, the array size is inside the malloc'd block, but it's
> still invisible to the calling function.
>
Please quit using negative language when you're so vehemently
agreeing with me.
The data is sometimes not at the beginning of the m
Michael Torrie :
> And one could also set A=1 and B=1 if he was trying to be stupid.
> [...]
> If Mark H wants to use an idiom that isn't conventional, or isn't
> widely used, he is free to do so; I can't see much harm in it. But
> certainly it's not the "normal" way that it's done in Python from
On 03/02/2014 07:43 AM, genius...@gmail.com wrote:
> I agree with you and really appreciate your experience. But what I
> was looking for is clues. Thank you anyway
Not sure what you mean. Chris certainly offered you clues to solving
this problem. Certainly he pointed you in the right direction t
On 03/02/2014 02:03 PM, Marko Rauhamaa wrote:
> Michael Torrie :
>
>> I don't see why == wouldn't continue to work if os.POSIX_FADV_RANDOM
>> became an object of a different type.
>
> It probably would.
>
> If one were begging for trouble, one *could* define:
>
>class ABC:
>A = 1
>
On Sunday, March 2, 2014 4:43:48 PM UTC+2, geni...@gmail.com wrote:
> I agree with you and really appreciate your experience. But what I was
> looking for is clues. Thank you anyway
#not tested
for i in range(n):
for j in range(n*2):
if i in (0, n - 1) or j in (0, n*2 - 1):
print('o',
On Mon, Mar 3, 2014 at 8:03 AM, Marko Rauhamaa wrote:
> If one were begging for trouble, one *could* define:
>
>class ABC:
>A = 1
>B = 1.0
>C = 1+0j
You're missing the point of flags, though. One does not use floats for
flags. Flags are normally going to be integers (p
In article <87txbg48kd@elektro.pacujo.net>,
Marko Rauhamaa wrote:
> Michael Torrie :
>
> > I don't see why == wouldn't continue to work if os.POSIX_FADV_RANDOM
> > became an object of a different type.
>
> It probably would.
>
> If one were begging for trouble, one *could* define:
>
>
Michael Torrie :
> I don't see why == wouldn't continue to work if os.POSIX_FADV_RANDOM
> became an object of a different type.
It probably would.
If one were begging for trouble, one *could* define:
class ABC:
A = 1
B = 1.0
C = 1+0j
Now:
ABC.A == ABC.B
ABC.B ==
On Mon, Mar 3, 2014 at 7:01 AM, Roy Smith wrote:
> We recently got a frothing email from a user, which basically said, "You
> farking idiots, you emailed me my password in plain text!" It turns
> out, his user name was the same as his password and what we had sent him
> (in response to an account
In article ,
Christian Heimes wrote:
> On 01.03.2014 21:11, Chris Angelico wrote:
> > The problem isn't SHA-256. The problem is insecure passwords, the way
> > we've been taught to make them by the banks. Hence, XKCD 936.
>
> Your argumentation is just wrong. You are saying "It's OK to use a
>
Marko Rauhamaa writes:
> Jabba Laci :
>
>> I tried this:
>>
>> #!/usr/bin/env python -u
>
> The hash-bang notation is quite rigid; it only accepts a single argument
> ("python") to the command ("/usr/bin/env").
>
> I don't know if there is a simple workaround.
Using the relevant environment vari
On Mon, Mar 3, 2014 at 6:17 AM, Dave Angel wrote:
> Array size is inside the malloc block, but outside the struct
> block. As you can see if you try to delete without the brackets
> when you used new [], some runtimes will crash.
As in, you have to use "delete [] x" to correspond with "x = new
On 01.03.2014 21:11, Chris Angelico wrote:
> The problem isn't SHA-256. The problem is insecure passwords, the way
> we've been taught to make them by the banks. Hence, XKCD 936.
Your argumentation is just wrong. You are saying "It's OK to use a
totally insecure way to hash passwords because passw
On Mon, Mar 3, 2014 at 3:55 AM, Mark Lawrence wrote:
> On 02/03/2014 16:45, Grant Edwards wrote:
>>
>>
>> That's irrelevent. The actual location of the memory containing the
>> struct object (static, stack, heap, shared) doesn't matter. The
>> address of the first field in a struture object _is_
Chris Angelico Wrote in message:
> On Mon, Mar 3, 2014 at 12:22 AM, Dave Angel wrote:
>> Sure, for some definition of "usable". Overhead such as block
>> size, freelist pointer etc., are obviously outside of the
>> returned block. But the array size that's specified in a call to
>> new [],
On Sun, Mar 2, 2014 at 2:38 PM, Roy Smith wrote:
> In article ,
> Stefan Behnel wrote:
>
>> Haven't seen any mention of it on this list yet, but since it's such an
>> obvious flaw in quite a number of programming languages, here's a good
>> article on the recent security bug in iOS, which was du
On 03/02/2014 03:07 AM, Chris Angelico wrote:
>
import os
type(os.POSIX_FADV_RANDOM)
>
>
> So use ==. If it's later changed and you have to instead use 'is', you
> can change your code.
I don't see why == wouldn't continue to work if os.POSIX_FADV_RANDOM
became an object of a differen
On 02/03/2014 16:45, Grant Edwards wrote:
That's irrelevent. The actual location of the memory containing the
struct object (static, stack, heap, shared) doesn't matter. The
address of the first field in a struture object _is_ the address of
the structure object.
You say struture, I'll say
On 02/03/2014 16:23, Chris Angelico wrote:
A switch block that works with constants and equality *can* be turned
into a dict. If the constants are hashable, use them as the keys
directly; if they're not hashable and/or you want to use object
identity as the criterion (effectively like using 'is'
On 2014-03-02, Dave Angel wrote:
> Grant Edwards Wrote in message:
>> On 2014-02-24, Michael Torrie wrote:
>>
>>>
>>> Why would you think that? The address of the start of your malloc'ed
>>> structure is the same as the address of the first element. Surely
>>> this is logical?
>>
>> Not only
Senior Python Engineer - User Interface Applications
Location : Cambridge MA
Who We Are:
Gen9 is transforming synthetic biology by creating novel technologies to
increase innovation within several industries including biopharmaceuticals,
fine chemicals and bio-fuels.
Currently such genes are
On Mon, Mar 3, 2014 at 2:52 AM, Marko Rauhamaa wrote:
> Roy Smith :
>
>> In article <87fvn08vux@elektro.pacujo.net>,
>> Marko Rauhamaa wrote:
>>> 3. TRY-EXCEPT (3500% slower than DICT DISPATCH TABLE)
>>
>> I'm glad to hear that. I hope nobody took me seriously when I
>> suggested this.
>
> I
On Mon, Mar 3, 2014 at 2:56 AM, Rita wrote:
> I am trying to achieve this, every time I commit to svn I automatically run
> hooks to test my libraries, ATM I am doing this manually
>
> cd libs
> PYTHONPATH=. python test_lib.py
>
> and if everything passes I do a svn commit -m 'committing code'
>
Hi,
I am trying to achieve this, every time I commit to svn I automatically
run hooks to test my libraries, ATM I am doing this manually
cd libs
PYTHONPATH=. python test_lib.py
and if everything passes I do a svn commit -m 'committing code'
I don't have access to my svn server so I can't crea
Roy Smith :
> In article <87fvn08vux@elektro.pacujo.net>,
> Marko Rauhamaa wrote:
>> 3. TRY-EXCEPT (3500% slower than DICT DISPATCH TABLE)
>
> I'm glad to hear that. I hope nobody took me seriously when I
> suggested this.
I actually have employed the idea before in a related but slightly
d
In article <87fvn08vux@elektro.pacujo.net>,
Marko Rauhamaa wrote:
> Marko Rauhamaa :
>
> > Roy Smith :
> >
> >> Python already has a switch statement. It's just spelled funny...
> >>
> >> [...]
> >>
> >> try:
> >>raise value
> >> except Case1:
> >>print "did case 1"
> >> except (Ca
Marko Rauhamaa :
> Roy Smith :
>
>> Python already has a switch statement. It's just spelled funny...
>>
>> [...]
>>
>> try:
>>raise value
>> except Case1:
>>print "did case 1"
>> except (Case2, Case3):
>>print "did either case 2 or 3"
>> else:
>>print "did default"
>
> Not bad! D
On 02/03/2014 14:43, genius...@gmail.com wrote:
I agree with you and really appreciate your experience. But what I was looking
for is clues. Thank you anyway
Sorry, can't resist this one https://www.youtube.com/watch?v=oaGpaj2nHIo :)
--
My fellow Pythonistas, ask not what our language can do
I agree with you and really appreciate your experience. But what I was looking
for is clues. Thank you anyway
--
https://mail.python.org/mailman/listinfo/python-list
In article ,
Stefan Behnel wrote:
> Haven't seen any mention of it on this list yet, but since it's such an
> obvious flaw in quite a number of programming languages, here's a good
> article on the recent security bug in iOS, which was due to accidentally
> duplicated code not actually being as
On Sun, 02 Mar 2014 15:17:11 +0100, Eric Jacoboni
wrote:
Le 02/03/2014 15:05, Mark Lawrence a écrit :
The behaviour is consistent except when you try to modify a tuple.
Not in my opinion...
li = [10, 30]
li = li + "spam" --> TypeError: can only concatenate list (not "str")
li += "spam
On 2014-03-03 01:08, Chris Angelico wrote:
> > if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
> > { goto fail;
> > goto fail;
> > }
>
> Put it this way: If I saw two gotos in a row like that, with or
> without braces, I would be firing up gitk or git gui blame or
> s
Le 02/03/2014 15:05, Mark Lawrence a écrit :
> The behaviour is consistent except when you try to modify a tuple.
>
Not in my opinion...
li = [10, 30]
li = li + "spam" --> TypeError: can only concatenate list (not "str")
li += "spam" --> Ok
So, not, that's not what i call consistent.
On Mon, Mar 3, 2014 at 12:22 AM, Dave Angel wrote:
> Sure, for some definition of "usable". Overhead such as block
> size, freelist pointer etc., are obviously outside of the
> returned block. But the array size that's specified in a call to
> new [], and the vptr, are definitely inside the
On Sun, Mar 2, 2014 at 11:36 PM, Ned Batchelder wrote:
> As much as I like indentation as syntax, and am amused by this bug, I'm not
> sure we can chalk it all up to space-vs-brace. After all, who would have
> wanted two goto's in a row even with braces? It's not like there's some
> engineer at A
On 02/03/2014 13:38, Eric Jacoboni wrote:
Le 02/03/2014 13:32, Ian Kelly a écrit :
On Sat, Mar 1, 2014 at 7:04 PM, Eric Jacoboni wrote:
In fact, i think i'm gonna forget += on lists :)
Well, do what you want, but I think you're taking the wrong lesson
from this. Don't forget about using +=
Le 02/03/2014 13:32, Ian Kelly a écrit :
> On Sat, Mar 1, 2014 at 7:04 PM, Eric Jacoboni wrote:
>> In fact, i think i'm gonna forget += on lists :)
>
> Well, do what you want, but I think you're taking the wrong lesson
> from this. Don't forget about using += on lists. Instead, forget
> about u
>BREAKING FUCKING NEWS, ASSHOLES!
>
THRINAXODON JUST FOUND THREE HUMAN FOSSILS FROM DEVONIAN STRATA IN
GREENLAND; THE FOSSILS WERE A HUMAN FEMUR, KNEECAP, AND SKULLCAP.
>
THE SMITHSONIAN IS CHASTISING OVER THESE FINDS, DOING EVERY
Chris Angelico Wrote in message:
> On Sun, Mar 2, 2014 at 3:02 PM, Dave Angel wrote:
>> The quote you make from the C standard doesn't mention malloc, so
>> you're arguing different things. It's not the compiler that casts
>> the malloc return value to the struct type.
>>
>> C++ does implicit
On 02/03/2014 09:35, Marko Rauhamaa wrote:
Steven D'Aprano :
On Sat, 01 Mar 2014 19:29:41 +0200, Marko Rauhamaa wrote:
Michael Torrie :
No, '==' works fine no matter what objects you assign to your state
variables.
Well, it doesn't since
>>> a = float("nan")
>>> a is a
True
On 02/03/2014 10:59, Ben Finney wrote:
Marko Rauhamaa writes:
Ben Finney :
The unreliability is “will objects defined elsewhere have a different
identity?”
That question is not interesting in my context, and has no bearing on
the correctness of the program.
You keep vacillating between t
On 3/2/14 5:41 AM, Stefan Behnel wrote:
Haven't seen any mention of it on this list yet, but since it's such an
obvious flaw in quite a number of programming languages, here's a good
article on the recent security bug in iOS, which was due to accidentally
duplicated code not actually being as ind
On Sat, Mar 1, 2014 at 7:04 PM, Eric Jacoboni wrote:
> In fact, i think i'm gonna forget += on lists :)
Well, do what you want, but I think you're taking the wrong lesson
from this. Don't forget about using += on lists. Instead, forget
about using assignments, augmented or otherwise, on tuple e
No, not always. You can use yuples as dictionary key as keys are immutable
and you can't use it as list.
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday 02 March 2014 07:05:06 Alister did opine:
> On Sun, 02 Mar 2014 09:16:35 +1100, Chris Angelico wrote:
> > On Sat, Mar 1, 2014 at 1:31 AM, Grant Edwards
> >
> >
> > wrote:
> >> You drag out the lab scope, logic analyzer, spectrum analyzer, sweep
> >> generator, strip plotter, and the ma
On 2014-03-02, Stefan Behnel wrote:
> Haven't seen any mention of it on this list yet, but since it's such an
> obvious flaw in quite a number of programming languages, here's a good
> article on the recent security bug in iOS, which was due to accidentally
> duplicated code not actually being as i
Steven D'Aprano :
> On Sun, 02 Mar 2014 11:35:43 +0200, Marko Rauhamaa wrote:
>> Now, what kinds of object are those constants? We are not supposed to
>> know or care.
>
> Incorrect. We are supposed to know and care.
Then, the documentation is seriously flawed. It gives no hint whatsoever
on the
On Sun, 02 Mar 2014 09:16:35 +1100, Chris Angelico wrote:
> On Sat, Mar 1, 2014 at 1:31 AM, Grant Edwards
> wrote:
>> You drag out the lab scope, logic analyzer, spectrum analyzer, sweep
>> generator, strip plotter, and the machine that goes "ping". You start
>> to get everything set up to nail
Marko Rauhamaa writes:
> Ben Finney :
>
> > The unreliability is “will objects defined elsewhere have a different
> > identity?”
>
> That question is not interesting in my context, and has no bearing on
> the correctness of the program.
You keep vacillating between two positions: pick one for th
On Sun, 02 Mar 2014 11:35:43 +0200, Marko Rauhamaa wrote:
> Nobody is saying there's a bug in the implementation of "==". I'm just
> saying "==" cannot be taken as a universal superset of "is". Therefore a
> program cannot blindly use "==" to test for identity.
Um, yes? Nor can you use ">" to tes
Haven't seen any mention of it on this list yet, but since it's such an
obvious flaw in quite a number of programming languages, here's a good
article on the recent security bug in iOS, which was due to accidentally
duplicated code not actually being as indented as it looked:
https://www.imperialv
Chris Angelico :
> And there's another thing you can do to test.
>
import os
type(os.POSIX_FADV_RANDOM)
>
Is that what you do in your programs?
> So use ==. If it's later changed and you have to instead use 'is', you
> can change your code.
Quite a robust API, huh?
Anyway, you recog
On Sun, Mar 2, 2014 at 8:35 PM, Marko Rauhamaa wrote:
> However, on the same reference page, os.posix_fadvise() is defined. We
> read:
>
>advice is one of POSIX_FADV_NORMAL, POSIX_FADV_SEQUENTIAL,
>POSIX_FADV_RANDOM, POSIX_FADV_NOREUSE, POSIX_FADV_WILLNEED or
>POSIX_FADV_DONTNEED
>
> N
On Sun, Mar 2, 2014 at 6:35 PM, Frank Millman wrote:
> I assume by 'warm cache' you mean that I had used the decimal module before
> and not switched the machine off before trying the above exercise.
>
> In my case, the machine was switched off before I started. I switched it on
> and executed the
Marko Rauhamaa :
> If I take the API documentation on its face value, [...]
> I *must* use "is" for os.POSIX_FAVD_*:
>
> if fsavd_flag is os.POSIX_FADV_RANDOM:
> ...
However, since a documentation flaw is more than likely, it is even more
prudent to avoid both "==" and "is" and create
Steven D'Aprano :
> On Sat, 01 Mar 2014 19:29:41 +0200, Marko Rauhamaa wrote:
>> Michael Torrie :
>>> No, '==' works fine no matter what objects you assign to your state
>>> variables.
>>
>> Well, it doesn't since
>>
>>>>> a = float("nan")
>>>>> a is a
>>True
>>>>> a == a
>>F
On Sat, 01 Mar 2014 19:29:41 +0200, Marko Rauhamaa wrote:
> Michael Torrie :
>
>> No, '==' works fine no matter what objects you assign to your state
>> variables.
>
> Well, it doesn't since
>
>>>> a = float("nan")
>>>> a is a
>True
>>>> a == a
>False
No, that is working co
Ben Finney :
> The unreliability is “will objects defined elsewhere have a different
> identity?”
That question is not interesting in my context, and has no bearing on
the correctness of the program.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
Roy Smith :
> Python already has a switch statement. It's just spelled funny...
>
> [...]
>
> try:
>raise value
> except Case1:
>print "did case 1"
> except (Case2, Case3):
>print "did either case 2 or 3"
> else:
>print "did default"
Not bad! Definitely worth considering.
> No f
Grant Edwards :
> any decent compiler should be able to generate the same code for a
> switch statement and for an equivalent chained if/else.
It's not so easy to be decent, especially when it comes to a language as
dynamic as Python.
Marko
--
https://mail.python.org/mailman/listinfo/python-li
100 matches
Mail list logo