Thanks, Peter for taking the time to respond. I need to study the reference
further, & your comments pointed out some of my misconceptions. Thank you
for clearing up some of my half-researched understanding.
Jim
On Thu, Sep 1, 2011 at 10:53 PM, Peter Otten <__pete...@web.de> wrote:
> James Hart
James Hartley wrote:
> I'm just needing to verify some behavior.
>
> Functionality within the logging module is exercised by calling functions
> defined within the module itself. I am using SQLAlchemy for database
> access, but it can be configured to dump out intermediate access
> information
>
On Thu, Sep 1, 2011 at 18:08, Steven D'Aprano wrote:
> Richard D. Moores wrote:
>>
>> I'm trying to write a general test for hashability. How can I test if
>> an object has both a __hash__() method and an __eq__() method?
>
>
> Just because an object has a __hash__ method doesn't mean it is guara
I'm just needing to verify some behavior.
Functionality within the logging module is exercised by calling functions
defined within the module itself. I am using SQLAlchemy for database
access, but it can be configured to dump out intermediate access information
& queries to the logging module --
On Thu, Sep 01, 2011 at 05:55:04PM -0700, Helen Brown wrote:
> Will someone share with me a link where I can download subject in order for
> my script to run? Any assistance will help!
Did you try googling for it?
http://duckduckgo.com/?q=openpyxl
http://www.bing.com/search?q=openpyxl
http://au
On Fri, Sep 02, 2011 at 12:17:48PM +1000, Steven D'Aprano wrote:
> Richard D. Moores wrote:
> >Thanks, James, from your ideas I've come up with this function as a
> >general test for hashibility of any object:
> >
> >def is_hashable(object):
> >try:
> >if hash(object):
> >re
Richard D. Moores wrote:
Thanks, James, from your ideas I've come up with this function as a
general test for hashibility of any object:
def is_hashable(object):
try:
if hash(object):
return True
except TypeError:
return False
No need for the "if hash" test,
Richard D. Moores wrote:
I'm trying to write a general test for hashability. How can I test if
an object has both a __hash__() method and an __eq__() method?
Just because an object has a __hash__ method doesn't mean it is
guaranteed to be hashable. The method might (deliberately, or
acciden
Ah. I'll follow you with that.
Thanks,
Dick
On Thu, Sep 1, 2011 at 15:42, Chris Fuller
wrote:
> On Thursday 01 September 2011, Richard D. Moores wrote:
>> On Thu, Sep 1, 2011 at 12:29, Chris Fuller
>>
>> wrote:
>> > *Ahem*
>> >
>> > def is_hashable(object):
>> > try:
>> > hash(object)
Will someone share if there is a link where I can download to read a script
with subject file?
Thanks,
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Will someone share with me a link where I can download subject in order for my
script to run? Any assistance will help!
Thanks,
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinf
On Thursday 01 September 2011, Richard D. Moores wrote:
> On Thu, Sep 1, 2011 at 12:29, Chris Fuller
>
> wrote:
> > *Ahem*
> >
> > def is_hashable(object):
> > try:
> >hash(object)
> >except TypeError:
> >return False
> >
> >return True
>
> Why is that preferred to
>
On Thu, Sep 1, 2011 at 12:29, Chris Fuller
wrote:
> *Ahem*
>
> def is_hashable(object):
> try:
> hash(object)
> except TypeError:
> return False
>
> return True
Why is that preferred to
def is_hashable(object):
try:
hash(object)
return True
except
On Thursday 01 September 2011, Chris Fuller wrote:
> On Thursday 01 September 2011, Richard D. Moores wrote:
> > Thanks, James, from your ideas I've come up with this function as a
> > general test for hashibility of any object:
> >
> > def is_hashable(object):
> > try:
> > if hash(obj
>
>
> >>> list = [3,]
> >>> a = list
> >>> list[0] = 6
> >>> a[0]
> 3
> -
>
Slight error in my code. It should be.
>>> list = [3,]
>>> a = list
>>> list[0] = 6
>>> a[0]
6
-
def is_hashable(object):
try:
hash(object)
return True
except TypeError:
return False
it is then. Thanks to all!
Dick
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pyth
I would use a tuple of dictionaries.
import random
quotes = (
{'author':"Kahlil Gibran", 'quote':"A candle loses nothing of its light
when
lighting another."), #My favorite
{'author':"Henrik Ibsen", 'quote':"The strongest man in the world is he
who stands
most alone."})
quote = random.choic
On 9/1/2011 11:30 AM Chris Fuller said...
On Thursday 01 September 2011, Richard D. Moores wrote:
Thanks, James, from your ideas I've come up with this function as a
general test for hashibility of any object:
def is_hashable(object):
try:
if hash(object):
return True
On Thursday 01 September 2011, Richard D. Moores wrote:
> Thanks, James, from your ideas I've come up with this function as a
> general test for hashibility of any object:
>
> def is_hashable(object):
> try:
> if hash(object):
> return True
> except TypeError:
>
On Thu, Sep 1, 2011 at 11:37 AM, Hugo Arts wrote:
> On Thu, Sep 1, 2011 at 5:28 PM, Richard D. Moores
> wrote:
> > Thanks, James, from your ideas I've come up with this function as a
> > general test for hashibility of any object:
> >
> > def is_hashable(object):
> >try:
> >if hash(o
On Thu, Sep 1, 2011 at 5:28 PM, Richard D. Moores wrote:
> Thanks, James, from your ideas I've come up with this function as a
> general test for hashibility of any object:
>
> def is_hashable(object):
> try:
> if hash(object):
> return True
> except TypeError:
> ret
Thanks, James, from your ideas I've come up with this function as a
general test for hashibility of any object:
def is_hashable(object):
try:
if hash(object):
return True
except TypeError:
return False
But is it? It returns True for ints, floats, sets, tuples,
On Thu, Sep 1, 2011 at 10:32 AM, Richard D. Moores wrote:
> The glossary defines "hashable" as:
>
> hashable
> An object is hashable if it has a hash value which never changes
> during its lifetime (it needs a __hash__() method), and can be
> compared to other objects (it needs an __eq__() method)
The glossary defines "hashable" as:
hashable
An object is hashable if it has a hash value which never changes
during its lifetime (it needs a __hash__() method), and can be
compared to other objects (it needs an __eq__() method). Hashable
objects which compare equal must have the same hash value.
This was meant to go to the list. I did notrealise that it had not until I
looked at the list just now and couln't see my reply. Sorry, "delegbede",
and sorry list.
On Wednesday 31 August 2011 Lisi wrote:
> ?? If either n or x or both were 0, and % were the same thing as *, the
> statement wo
questions anon wrote:
> I have been going round in circles trying to solve something that sounds
> simple. I have a huge array and I would like to reclassify the values.
> Firstly just make them zeros and ones, for example if the values in the
> array are less than 100 make them 0 and if greater t
On Thu, 1 Sep 2011, 01:17:45 CEST, questions anon
wrote:
> Firstly just make them zeros and ones, for example if the values in the
> array are less than 100 make them 0 and if greater than 100 make them 1.
> And then finally sum them together.
> I have attempted a few methods, see code below.
27 matches
Mail list logo