auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-01 Thread naveen
Hi,

I have to make an application in which, 

The user asks a question, Google's API is used to convert the speech to text. 
But the problem is due to different accent the translator misunderstands the 
words. 
I want my application to guess the word to the nearest word spoken by the user. 
When the user speaks a word, the syllables in the word should be matched with 
the syllables of other words in my dictionary. 
Till now what I have done,
I used CMU pronouncing dictionary. It contains ~122300 words along with its 
syllables.
Along with this, I have created my own dictionary which consists of words that 
I need only.
I have implemented a python logic that makes reasonable guesses for the words 
user speaks and matches with my dictionary.
But sometimes for more than a word it makes the same guess.
example:
The user speaks "Light". The system translates it as "Bright"
The user speaks "White" The system translates it as "Bright"
I don't want this to happen. This system should make a reasonable conversion.

Any help would be appreciated.

I am using python for logic.

Regards,
Naveen BM
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPy support breaking CPython compatibility?

2018-02-01 Thread Etienne Robillard



Le 2018-01-31 à 05:21, Ned Batchelder a écrit :

On 1/30/18 3:58 PM, Etienne Robillard wrote:

Hi Ned,


Le 2018-01-30 à 15:14, Ned Batchelder a écrit :
I'm curious what you had to change for PyPy? (Unless it's a Py2/Py3 
thing as Chris mentions.) 


Please take a look at the changesets:

https://bitbucket.org/tkadm30/libschevo/commits/745d1aeab5c6ee0d336790cf13d16f327e10c2f8 

https://bitbucket.org/tkadm30/libdurus/commits/875636e9b6caa840fd50ca87d69217d87fc06f43 



In short, it seems PyPy automagically adds a __weakref__ attribute to 
__slots__, causing the CPython interpreter to raise a TypeError...


PyPy and CPython are separate implementations, that never mix: you run 
your code in one, or in the other.  How can PyPy do something at 
runtime (add a __weakref__ attribute to __slots__) that can cause 
CPython to do something at runtime (raise a TypeError)?


Sorry Ned for the confusion. This is strictly a PyPy issue. CPython does 
not raise a TypeError.





A small demonstration case would be very helpful for figuring out what 
is going on.


Yes

The problem is with the following code on PyPy 5.9:

class MyClass(object):
  __slots__ = ['__weakref__',]





--Ned.


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
https://mail.python.org/mailman/listinfo/python-list


Re: for info

2018-02-01 Thread Mario R. Osorio
On Wednesday, January 31, 2018 at 10:55:59 AM UTC-5, M.Haroon Ali wrote:
> from where we learn python for free of cost. i am begineer in python.plzz 
> help me

And after you're done with the OFFICIAL tutorials; there thousands of excellent 
free tutorials online. Just do some research.

If you're more of the 'visual' person, you can also find tutorials in youtube. 
http://udemy.com also offers many free courses.

HTH
-- 
https://mail.python.org/mailman/listinfo/python-list


Problem with coroutines old-style / new-style usage and features

2018-02-01 Thread Yahya Abou 'Imran via Python-list
Hi guys.

I am discovering coroutines and asynchronous programming, and I have a little 
problem with a little example I'm coding myself as an excercice.

Let say you take two guys in the street: Dave and Bryan.
You ask dave to count from 1 to 50, 1 by 1. He will do it fast.
And you ask Bryan to count from 208 to 166 in reversing order, 7 by 7! It will 
take him some time between each number to think about it.

Now I have a recorder wich is able to recognize voices. I use it to record both 
of them counting at the same time.

Here is the recorder:


@asyncio.coroutine
def recorder():
dialog = []
while True:
sent = yield dialog
if sent is not None:
name, things = sent
dialog.append(f'{name} says : {things}')


It is storing the dialog, and you can ask him fot it later by sending None to 
it.

For the calculation, I'm using a ascyn generator:


async def calcul_mental(range_args, name, timeout=0.2):
for i in range(*range_args):
await asyncio.sleep(timeout)
yield name, i


To link the two, I came up with this little coroutine:


async def record(recorder, gen):
async for name, i in gen:
recorder.send([name, i])


And my main:


def main():

g1 = calcul_mental([1, 51],
   name='Dave',
   timeout=0.2)

g2 = calcul_mental([208, 165, -7],
   name='Bryan',
   timeout=2)

r = recorder()
r.send(None)

coros = asyncio.gather(record(r, g1), record(r, g2))
loop = asyncio.get_event_loop()
loop.run_until_complete(coros)

dialog = r.send(None)
for line in dialog:
print(line)


It works well, but I was wondering if I could turn recorder into a new style 
coroutine...

The problems are:
- I can't await for an async generator;
- I can't let an await alone to send data to it;
- I can't turn it into an AsyncGenerator because it will lost the .send() 
method.

I think it's just a problem of design, but I wasn't able to solve it myself.

Any thoughts about it?

Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Dependency injection: overriding defaults

2018-02-01 Thread Victor Porton
dieter wrote:

> Victor Porton  writes:
> 
>> I am writing a library, a command line utility which uses the library,
>> and a I am going to use dependency_injector package.
>>
>> Consider loggers:
>>
>> For the core library the logger should default to stderr.
>>
>> For the command line utility, we use the default logger of the library.
>>
>> For the server, the log should go to a file (not to stderr).
>>
>> Question: How to profoundly make my software to use the appropriate
>> logger, dependently on whether it is a command line utility or the
>> daemon?
> 
> I would distinguish between the common library and distinct
> applications (command line utility, daemon). The applications
> configure the logging system (differently) while the library uses
> uniform logging calls.

You have essentially just repeated my requirements.

But HOW to do this (using dependency_injector module)?

-- 
Victor Porton - http://portonvictor.org
-- 
https://mail.python.org/mailman/listinfo/python-list


This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread superchromix

Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, 
started receiving spam messages several months ago.

Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups.  

When trying to access comp.lang.idl-pvwave, a message is now displayed, stating 
that the group owner needs to remove the spam, and can then apply to Google in 
order to have access reinstated.

However, old public Usenet groups like this have no owner.  The 
comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is no way 
to unblock the group.

This is a serious problem, since the entire collection of postings going back 
many years has been blocked, no just the spam.  This resource is frequently 
used by IDL programmers.

Seeing the spam postings in this newsgroup, I expect something similar may 
happen to comp.lang.python, soon.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread alister via Python-list
On Thu, 01 Feb 2018 09:01:35 -0800, superchromix wrote:

> Our own programming discussion newsgroup, located at
> comp.lang.idl-pvwave, started receiving spam messages several months
> ago.
> 
> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google
> Groups.
> 
> When trying to access comp.lang.idl-pvwave, a message is now displayed,
> stating that the group owner needs to remove the spam, and can then
> apply to Google in order to have access reinstated.
> 
> However, old public Usenet groups like this have no owner.  The
> comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is
> no way to unblock the group.
> 
> This is a serious problem, since the entire collection of postings going
> back many years has been blocked, no just the spam.  This resource is
> frequently used by IDL programmers.
> 
> Seeing the spam postings in this newsgroup, I expect something similar
> may happen to comp.lang.python, soon.

simple solution stop using google groups & use either the mailing list or 
a news server with an NNTP client



-- 
Your wig steers the gig.
-- Lord Buckley
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Jack Dangler



On 02/01/2018 12:06 PM, alister via Python-list wrote:

On Thu, 01 Feb 2018 09:01:35 -0800, superchromix wrote:


Our own programming discussion newsgroup, located at
comp.lang.idl-pvwave, started receiving spam messages several months
ago.

Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google
Groups.

When trying to access comp.lang.idl-pvwave, a message is now displayed,
stating that the group owner needs to remove the spam, and can then
apply to Google in order to have access reinstated.

However, old public Usenet groups like this have no owner.  The
comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is
no way to unblock the group.

This is a serious problem, since the entire collection of postings going
back many years has been blocked, no just the spam.  This resource is
frequently used by IDL programmers.

Seeing the spam postings in this newsgroup, I expect something similar
may happen to comp.lang.python, soon.

simple solution stop using google groups & use either the mailing list or
a news server with an NNTP client



Is it possible to name an 'owner' and then get into the group archive to 
remove the spam by account "recovery" ?


--
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Tim Golden

On 01/02/2018 17:01, superchromix wrote:


Our own programming discussion newsgroup, located at
comp.lang.idl-pvwave, started receiving spam messages several months
ago.

Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google
Groups.

When trying to access comp.lang.idl-pvwave, a message is now
displayed, stating that the group owner needs to remove the spam, and
can then apply to Google in order to have access reinstated.

However, old public Usenet groups like this have no owner.  The
comp.lang.idl-pvwave group is more than 20 years old.  Hence, there
is no way to unblock the group.

This is a serious problem, since the entire collection of postings
going back many years has been blocked, no just the spam.  This
resource is frequently used by IDL programmers.

Seeing the spam postings in this newsgroup, I expect something
similar may happen to comp.lang.python, soon.



Thanks for the heads-up. I'm not sure there's anything we'll be able to 
do. Google have seemed remarkably uninterested in Google Groups for some 
years now.


Although I recognise how useful GG is for some people, I wouldn't be 
sorry [as a list maintainer here] if it were to be blocked for good by 
forces outside our control. We've wondered several times whether we 
ought to be block its posts outright, but to date we've simply used 
refined filters to block the spam and other abuse. If Google essentially 
close the group down, the decision is taken out of our hands.


TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 4:01 AM, superchromix  wrote:
>
> Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, 
> started receiving spam messages several months ago.
>
> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups.
>
> When trying to access comp.lang.idl-pvwave, a message is now displayed, 
> stating that the group owner needs to remove the spam, and can then apply to 
> Google in order to have access reinstated.
>
> However, old public Usenet groups like this have no owner.  The 
> comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is no way 
> to unblock the group.
>
> This is a serious problem, since the entire collection of postings going back 
> many years has been blocked, no just the spam.  This resource is frequently 
> used by IDL programmers.
>
> Seeing the spam postings in this newsgroup, I expect something similar may 
> happen to comp.lang.python, soon.
>

Pot, meet Kettle.

Most of our worst spam comes FROM the Google Groups bridge. If they
cut the connection, I would not be sorry.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread markb77
On Thursday, February 1, 2018 at 6:22:22 PM UTC+1, Jack Dangler wrote:
> On 02/01/2018 12:06 PM, alister via Python-list wrote:
> > On Thu, 01 Feb 2018 09:01:35 -0800, superchromix wrote:
> >
> >> Our own programming discussion newsgroup, located at
> >> comp.lang.idl-pvwave, started receiving spam messages several months
> >> ago.
> >>
> >> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google
> >> Groups.
> >>
> >> When trying to access comp.lang.idl-pvwave, a message is now displayed,
> >> stating that the group owner needs to remove the spam, and can then
> >> apply to Google in order to have access reinstated.
> >>
> >> However, old public Usenet groups like this have no owner.  The
> >> comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is
> >> no way to unblock the group.
> >>
> >> This is a serious problem, since the entire collection of postings going
> >> back many years has been blocked, no just the spam.  This resource is
> >> frequently used by IDL programmers.
> >>
> >> Seeing the spam postings in this newsgroup, I expect something similar
> >> may happen to comp.lang.python, soon.
> > simple solution stop using google groups & use either the mailing list or
> > a news server with an NNTP client
> >
> >
> >
> Is it possible to name an 'owner' and then get into the group archive to 
> remove the spam by account "recovery" ?

Is this possible within the framework of the Usenet?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread markb77
On Thursday, February 1, 2018 at 6:01:58 PM UTC+1, superchromix wrote:
> Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, 
> started receiving spam messages several months ago.
> 
> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups.  
> 
> When trying to access comp.lang.idl-pvwave, a message is now displayed, 
> stating that the group owner needs to remove the spam, and can then apply to 
> Google in order to have access reinstated.
> 
> However, old public Usenet groups like this have no owner.  The 
> comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is no way 
> to unblock the group.
> 
> This is a serious problem, since the entire collection of postings going back 
> many years has been blocked, no just the spam.  This resource is frequently 
> used by IDL programmers.
> 
> Seeing the spam postings in this newsgroup, I expect something similar may 
> happen to comp.lang.python, soon.

The problem I have now is that there is no public, searchable archive of 
comp.lang.idl-pvwave available.  This was the real benefit of Google groups, 
from my point of view.

There is something called "narkive", but its search function seems to be 
broken, and it doesn't archive very far back in time.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 4:50 AM,   wrote:
> On Thursday, February 1, 2018 at 6:01:58 PM UTC+1, superchromix wrote:
>> Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, 
>> started receiving spam messages several months ago.
>>
>> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups.
>>
>> When trying to access comp.lang.idl-pvwave, a message is now displayed, 
>> stating that the group owner needs to remove the spam, and can then apply to 
>> Google in order to have access reinstated.
>>
>> However, old public Usenet groups like this have no owner.  The 
>> comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is no 
>> way to unblock the group.
>>
>> This is a serious problem, since the entire collection of postings going 
>> back many years has been blocked, no just the spam.  This resource is 
>> frequently used by IDL programmers.
>>
>> Seeing the spam postings in this newsgroup, I expect something similar may 
>> happen to comp.lang.python, soon.
>
> The problem I have now is that there is no public, searchable archive of 
> comp.lang.idl-pvwave available.  This was the real benefit of Google groups, 
> from my point of view.
>
> There is something called "narkive", but its search function seems to be 
> broken, and it doesn't archive very far back in time.
>

Which is why you don't rely on proprietary services if you don't have
to. They can go away at any time, without notice.

Fortunately, python-list has its own archive, so you can access that
from python.org independently of the newsgroup's availability
elsewhere on the internet. It doesn't have all the posts that are on
the newsgroup and not on the mailing list, but IMO that's a feature,
not a bug. (With the possible exception of the "no-archive" posts.
Possible exception only.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread mm0fmf

On 01/02/2018 17:15, Chris Angelico wrote:

On Fri, Feb 2, 2018 at 4:01 AM, superchromix  wrote:


Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, 
started receiving spam messages several months ago.

Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups.

When trying to access comp.lang.idl-pvwave, a message is now displayed, stating 
that the group owner needs to remove the spam, and can then apply to Google in 
order to have access reinstated.

However, old public Usenet groups like this have no owner.  The 
comp.lang.idl-pvwave group is more than 20 years old.  Hence, there is no way 
to unblock the group.

This is a serious problem, since the entire collection of postings going back 
many years has been blocked, no just the spam.  This resource is frequently 
used by IDL programmers.

Seeing the spam postings in this newsgroup, I expect something similar may 
happen to comp.lang.python, soon.



Pot, meet Kettle.

Most of our worst spam comes FROM the Google Groups bridge. If they
cut the connection, I would not be sorry.


 ^^

This. This a googol times!

--
https://mail.python.org/mailman/listinfo/python-list


Create an alias to an attribute on superclass

2018-02-01 Thread Sean DiZazzo
Hi!

I basically just want to create an alias to an attribute on an item's 
superclass.  So that after I create the subclass object, I can access the alias 
attribute to get the value back.


class Superclass(object):
def __init__(self, value):
"""
I want to pass x by reference, so that any time
x on the subclass is updated, so is the alias here
"""
self.alias = value

class Subclass(Superclass):
def __init__(self, x):
self.x = x
Superclass.__init__(self, self.x)

def __repr__(self):
return "x: %s\nalias: %s" % (self.x, self.alias)


if __name__ == "__main__":
foo = Subclass(1)
print foo.alias

foo.x = 6
# Should return 6 !!!
print foo.alias


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create an alias to an attribute on superclass

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo  wrote:
> Hi!
>
> I basically just want to create an alias to an attribute on an item's 
> superclass.  So that after I create the subclass object, I can access the 
> alias attribute to get the value back.
>
> 
> class Superclass(object):
> def __init__(self, value):
> """
> I want to pass x by reference, so that any time
> x on the subclass is updated, so is the alias here
> """
> self.alias = value
>
> class Subclass(Superclass):
> def __init__(self, x):
> self.x = x
> Superclass.__init__(self, self.x)
>
> def __repr__(self):
> return "x: %s\nalias: %s" % (self.x, self.alias)
>
>
> if __name__ == "__main__":
> foo = Subclass(1)
> print foo.alias
>
> foo.x = 6
> # Should return 6 !!!
> print foo.alias
>
> 

ISTM the easiest way would be to define a property on the superclass:

class Superclass(object):
@property
def alias(self):
return self.x

Whatever happens, self.alias will be identical to self.x. Is that what
you're after?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create an alias to an attribute on superclass

2018-02-01 Thread Sean DiZazzo
On Thursday, February 1, 2018 at 10:37:32 AM UTC-8, Chris Angelico wrote:
> On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo  wrote:
> > Hi!
> >
> > I basically just want to create an alias to an attribute on an item's 
> > superclass.  So that after I create the subclass object, I can access the 
> > alias attribute to get the value back.
> >
> > 
> > class Superclass(object):
> > def __init__(self, value):
> > """
> > I want to pass x by reference, so that any time
> > x on the subclass is updated, so is the alias here
> > """
> > self.alias = value
> >
> > class Subclass(Superclass):
> > def __init__(self, x):
> > self.x = x
> > Superclass.__init__(self, self.x)
> >
> > def __repr__(self):
> > return "x: %s\nalias: %s" % (self.x, self.alias)
> >
> >
> > if __name__ == "__main__":
> > foo = Subclass(1)
> > print foo.alias
> >
> > foo.x = 6
> > # Should return 6 !!!
> > print foo.alias
> >
> > 
> 
> ISTM the easiest way would be to define a property on the superclass:
> 
> class Superclass(object):
> @property
> def alias(self):
> return self.x
> 
> Whatever happens, self.alias will be identical to self.x. Is that what
> you're after?
> 
> ChrisA

Yes, but that doesn't seem to work.  It looks like there is a way to do it if 
you make the original value a list (mutable) instead of an integer.  I really 
need to do it with an arbitrary object.  Not sure if I can hack the list trick 
to work in my case though.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create an alias to an attribute on superclass

2018-02-01 Thread Chris Angelico
On Fri, Feb 2, 2018 at 5:44 AM, Sean DiZazzo  wrote:
> On Thursday, February 1, 2018 at 10:37:32 AM UTC-8, Chris Angelico wrote:
>> On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo  wrote:
>> > Hi!
>> >
>> > I basically just want to create an alias to an attribute on an item's 
>> > superclass.  So that after I create the subclass object, I can access the 
>> > alias attribute to get the value back.
>> >
>> > 
>> > class Superclass(object):
>> > def __init__(self, value):
>> > """
>> > I want to pass x by reference, so that any time
>> > x on the subclass is updated, so is the alias here
>> > """
>> > self.alias = value
>> >
>> > class Subclass(Superclass):
>> > def __init__(self, x):
>> > self.x = x
>> > Superclass.__init__(self, self.x)
>> >
>> > def __repr__(self):
>> > return "x: %s\nalias: %s" % (self.x, self.alias)
>> >
>> >
>> > if __name__ == "__main__":
>> > foo = Subclass(1)
>> > print foo.alias
>> >
>> > foo.x = 6
>> > # Should return 6 !!!
>> > print foo.alias
>> >
>> > 
>>
>> ISTM the easiest way would be to define a property on the superclass:
>>
>> class Superclass(object):
>> @property
>> def alias(self):
>> return self.x
>>
>> Whatever happens, self.alias will be identical to self.x. Is that what
>> you're after?
>>
>> ChrisA
>
> Yes, but that doesn't seem to work.  It looks like there is a way to do it if 
> you make the original value a list (mutable) instead of an integer.  I really 
> need to do it with an arbitrary object.  Not sure if I can hack the list 
> trick to work in my case though.
>

Can you post your actual code? The alias will be looked up whenever
you ask for it, so it won't be a copy.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create an alias to an attribute on superclass

2018-02-01 Thread Ian Kelly
On Thu, Feb 1, 2018 at 11:44 AM, Sean DiZazzo  wrote:
> On Thursday, February 1, 2018 at 10:37:32 AM UTC-8, Chris Angelico wrote:
>> On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo  wrote:
>> > Hi!
>> >
>> > I basically just want to create an alias to an attribute on an item's 
>> > superclass.  So that after I create the subclass object, I can access the 
>> > alias attribute to get the value back.
>> >
>> > 
>> > class Superclass(object):
>> > def __init__(self, value):
>> > """
>> > I want to pass x by reference, so that any time
>> > x on the subclass is updated, so is the alias here
>> > """
>> > self.alias = value
>> >
>> > class Subclass(Superclass):
>> > def __init__(self, x):
>> > self.x = x
>> > Superclass.__init__(self, self.x)
>> >
>> > def __repr__(self):
>> > return "x: %s\nalias: %s" % (self.x, self.alias)
>> >
>> >
>> > if __name__ == "__main__":
>> > foo = Subclass(1)
>> > print foo.alias
>> >
>> > foo.x = 6
>> > # Should return 6 !!!
>> > print foo.alias
>> >
>> > 
>>
>> ISTM the easiest way would be to define a property on the superclass:
>>
>> class Superclass(object):
>> @property
>> def alias(self):
>> return self.x
>>
>> Whatever happens, self.alias will be identical to self.x. Is that what
>> you're after?
>>
>> ChrisA
>
> Yes, but that doesn't seem to work.  It looks like there is a way to do it if 
> you make the original value a list (mutable) instead of an integer.  I really 
> need to do it with an arbitrary object.  Not sure if I can hack the list 
> trick to work in my case though.

What about it doesn't work? Did you want to be able to set the value
via the alias as well? Then use a property with a setter:

class Superclass(object):
@property
def alias(self):
return self.x

@alias.setter
def alias(self, value):
self.x = value
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create an alias to an attribute on superclass

2018-02-01 Thread Sean DiZazzo
On Thursday, February 1, 2018 at 10:23:06 AM UTC-8, Sean DiZazzo wrote:
> Hi!
> 
> I basically just want to create an alias to an attribute on an item's 
> superclass.  So that after I create the subclass object, I can access the 
> alias attribute to get the value back.
> 
> 
> class Superclass(object):
> def __init__(self, value):
> """
> I want to pass x by reference, so that any time
> x on the subclass is updated, so is the alias here
> """
> self.alias = value
> 
> class Subclass(Superclass):
> def __init__(self, x):
> self.x = x
> Superclass.__init__(self, self.x)
> 
> def __repr__(self):
> return "x: %s\nalias: %s" % (self.x, self.alias)
> 
> 
> if __name__ == "__main__":
> foo = Subclass(1)
> print foo.alias
> 
> foo.x = 6
> # Should return 6 !!!
> print foo.alias
> 
> 

Yep.  Thats it.  Thank you guys!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create an alias to an attribute on superclass

2018-02-01 Thread Ben Finney
Sean DiZazzo  writes:

> I basically just want to create an alias to an attribute on an item's
> superclass.

This description – “attribute on an item's superclass” – does not match
what you have described in the rest of the message.

Note the difference between an attribute ‘spam’ on a class ‘Lorem’
(accessed via ‘Lorem.foo’, shared among all instances of ‘Lorem’),
versus an attribute ‘spam’ on a specific instance of ‘Lorem’.

For more information, read about how Python resolves an attribute
reference from an instance, then to its class, and so on:

 A class instance has a namespace implemented as a dictionary which
 is the first place in which attribute references are searched. When
 an attribute is not found there, and the instance’s class has an
 attribute by that name, the search continues with the class attributes.

 
https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy>

So, if the instance has an attribute ‘spam’, then a reference to that
name will first find the instance's attribute. If not, the class
attribute will be tried; and then that class's superclass; and so on
through the inheritance tree.

Typically, you bind an attribute on the class when you want that
reference shared (e.g. a default) for all the instances of that class;
and you bind an attribute on the instance when you want that reference
to be specific to that instance.

> So that after I create the subclass object, I can access the alias
> attribute to get the value back.

Any instance method can interrogate ‘self.spam’ to ask for that
instance's ‘spam’ attribute. This is true regardless of which class
defines that method.

What problem are you experiencing, and why do you think the default
attribute access behaviour is not enough?

-- 
 \“Sane people have an appropriate perspective on the relative |
  `\ importance of foodstuffs and human beings. Crazy people can't |
_o__) tell the difference.” —Paul Z. Myers, 2010-04-18 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Jan van den Broek
On 2018-02-01, superchromix  wrote:
>
> Our own programming discussion newsgroup, located at comp.lang.idl-pvwave, 
>started receiving spam messages several months ago.
>
> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google Groups.  
>
> When trying to access comp.lang.idl-pvwave, a message is now displayed, 
>stating that the group owner needs to remove the spam, and can then apply 
>to Google in order to have access reinstated.

[Schnipp]

Personally I would see this as an improvement.
-- 
Jan v/d Broek
balgl...@dds.nl
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with coroutines old-style / new-style usage and features

2018-02-01 Thread Ian Kelly
On Thu, Feb 1, 2018 at 5:38 AM, Yahya Abou 'Imran via Python-list
 wrote:
> Hi guys.
>
> I am discovering coroutines and asynchronous programming, and I have a little 
> problem with a little example I'm coding myself as an excercice.
>
> Let say you take two guys in the street: Dave and Bryan.
> You ask dave to count from 1 to 50, 1 by 1. He will do it fast.
> And you ask Bryan to count from 208 to 166 in reversing order, 7 by 7! It 
> will take him some time between each number to think about it.
>
> Now I have a recorder wich is able to recognize voices. I use it to record 
> both of them counting at the same time.
>
> Here is the recorder:
>
>
> @asyncio.coroutine
> def recorder():
> dialog = []
> while True:
> sent = yield dialog
> if sent is not None:
> name, things = sent
> dialog.append(f'{name} says : {things}')

This is not an asyncio coroutine. This is just a normal generator that
you're sending to. So you should probably remove the decorator to
prevent confusion. For that matter I'm not really sure why this isn't
just a class with synchronous "add" and "get" methods.

> It is storing the dialog, and you can ask him fot it later by sending None to 
> it.
>
> For the calculation, I'm using a ascyn generator:
>
>
> async def calcul_mental(range_args, name, timeout=0.2):
> for i in range(*range_args):
> await asyncio.sleep(timeout)
> yield name, i
>
>
> To link the two, I came up with this little coroutine:
>
>
> async def record(recorder, gen):
> async for name, i in gen:
> recorder.send([name, i])
>
>
> And my main:
>
>
> def main():
>
> g1 = calcul_mental([1, 51],
>name='Dave',
>timeout=0.2)
>
> g2 = calcul_mental([208, 165, -7],
>name='Bryan',
>timeout=2)
>
> r = recorder()
> r.send(None)
>
> coros = asyncio.gather(record(r, g1), record(r, g2))
> loop = asyncio.get_event_loop()
> loop.run_until_complete(coros)
>
> dialog = r.send(None)
> for line in dialog:
> print(line)
>
>
> It works well, but I was wondering if I could turn recorder into a new style 
> coroutine...

Why? It doesn't do anything asynchronously.

> The problems are:
> - I can't await for an async generator;
> - I can't let an await alone to send data to it;
> - I can't turn it into an AsyncGenerator because it will lost the .send() 
> method.
>
> I think it's just a problem of design, but I wasn't able to solve it myself.
>
> Any thoughts about it?

If it were a class, then you could make the individual methods be
coroutines if desired and await those.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Grant Edwards
On 2018-02-01, Jan van den Broek  wrote:
> On 2018-02-01, superchromix  wrote:
>>
>> Our own programming discussion newsgroup, located at
>> comp.lang.idl-pvwave, started receiving spam messages several
>> months ago.
>>
>> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google
>> Groups.
[...]
> [Schnipp]
>
> Personally I would see this as an improvement.

I plonked all posts from google groops yonks ago.  Now that gmane's
web UI is gone, maybe google groups is useful as a searchable archive
(I don't know, I've never used it).  For me, google groups is nothing
but a source of spam.

-- 
Grant Edwards   grant.b.edwardsYow! Let's send the
  at   Russians defective
  gmail.comlifestyle accessories!

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with coroutines old-style / new-style usage and features

2018-02-01 Thread Yahya Abou 'Imran via Python-list
>> @asyncio.coroutine
>> def recorder():
>> dialog = []
>> while True:
>> sent = yield dialog
>> if sent is not None:
>> name, things = sent
>> dialog.append(f'{name} says : {things}')
>This is not an asyncio coroutine. This is just a normal generator that
> you're sending to. So you should probably remove the decorator to
> prevent confusion. For that matter I'm not really sure why this isn't
> just a class with synchronous "add" and "get" methods.

Yeah it's true. I would just instantiate it, send to it and ask for a result. 
To pass it to next to start it and to retrieve a value is not really explicit.

[...]
>>It works well, but I was wondering if I could turn recorder into a new style 
>>coroutine...
>Why? It doesn't do anything asynchronously.

Hey, you're right... I was just, you know... "Async is so cool, let's just 
async everything!"

>If it were a class, then you could make the individual methods be
> coroutines if desired and await those.

Thanks for your advise Ian!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Pete Forman
mark...@gmail.com writes:

> On Thursday, February 1, 2018 at 6:01:58 PM UTC+1, superchromix wrote:
>> Our own programming discussion newsgroup, located at
>> comp.lang.idl-pvwave, started receiving spam messages several months
>> ago.
>>
>> Two weeks ago, access to comp.lang.idl-pvwave was blocked by Google
>> Groups.
>>
>> When trying to access comp.lang.idl-pvwave, a message is now
>> displayed, stating that the group owner needs to remove the spam,
>> and can then apply to Google in order to have access reinstated.
>>
>> However, old public Usenet groups like this have no owner. The
>> comp.lang.idl-pvwave group is more than 20 years old. Hence, there
>> is no way to unblock the group.
>>
>> This is a serious problem, since the entire collection of postings
>> going back many years has been blocked, no just the spam. This
>> resource is frequently used by IDL programmers.
>>
>> Seeing the spam postings in this newsgroup, I expect something
>> similar may happen to comp.lang.python, soon.
>
> The problem I have now is that there is no public, searchable archive
> of comp.lang.idl-pvwave available. This was the real benefit of Google
> groups, from my point of view.
>
> There is something called "narkive", but its search function seems to
> be broken, and it doesn't archive very far back in time.

A couple of other mail archivers are:

https://www.mail-archive.com
https://marc.info

-- 
Pete Forman
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Dependency injection: overriding defaults

2018-02-01 Thread Kushal Kumaran
Victor Porton  writes:

> dieter wrote:
>
>> Victor Porton  writes:
>> 
>>> I am writing a library, a command line utility which uses the library,
>>> and a I am going to use dependency_injector package.
>>>
>>> Consider loggers:
>>>
>>> For the core library the logger should default to stderr.
>>>
>>> For the command line utility, we use the default logger of the library.
>>>
>>> For the server, the log should go to a file (not to stderr).
>>>
>>> Question: How to profoundly make my software to use the appropriate
>>> logger, dependently on whether it is a command line utility or the
>>> daemon?
>> 
>> I would distinguish between the common library and distinct
>> applications (command line utility, daemon). The applications
>> configure the logging system (differently) while the library uses
>> uniform logging calls.
>
> You have essentially just repeated my requirements.
>
> But HOW to do this (using dependency_injector module)?
>

No idea how dependency_injector affects this, but have you read the
logging howto? The section
https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
would be appropriate.

-- 
regards,
kushal
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Trace back error just trying to run a simple import of requests

2018-02-01 Thread William Sewell
My python script which I run daily just blew up.  So, I went into python to 
diagnose and just typed in the first line - import requests.  I received 
screenfulls of errors.  Why?  What could have happened when nothing changed on 
my end?  The traceback is copied below.


[cid:image001.png@01D39B71.014E8850]


Dr. William Sewell
Direct Line: 385.428.5377  Toll Free: 877.435.7948 ext 5377
Course Instructor, IT

WGU will be closed President's Day, February 19th.
Mountain Time Office hours: Sun 3:00 PM - 8:00 PM, Mon 6:30 AM - 3:30 PM, Tue 
9:30 AM - 6:30 PM, Wed 9:00 AM - 5:00 PM, Thu 6:30 AM - 3:30 PM
Your success is very important to me.
IT MSDA and Database Team
cmdatab...@wgu.edu
Toll Free: 1-877-435-7948
Student Services: 1-866-903-0110
WellConnect Counseling Services: 1-877-685-3269
Western Governors University
mailto:william.sew...@wgu.edu

[WGU]

More about WGU in Fast Company, CNN, NPR, NBC Nightly News, Money, The 
Atlantic, TIME, etc.
wgu.edu


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for info

2018-02-01 Thread Dan Stromberg
On Wed, Jan 31, 2018 at 7:55 AM,   wrote:
> from where we learn python for free of cost. i am begineer in python.plzz 
> help me

If you already know another programming language:
https://wiki.python.org/moin/BeginnersGuide/Programmers

If you're making Python your first language:
https://wiki.python.org/moin/BeginnersGuide/NonProgrammers

HTH
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trace back error just trying to run a simple import of requests

2018-02-01 Thread Grant Edwards
On 2018-02-01, William Sewell  wrote:

> My python script which I run daily just blew up.  So, I went into
> python to diagnose and just typed in the first line - import
> requests.  I received screenfulls of errors.  Why?  What could have
> happened when nothing changed on my end?  The traceback is copied
> below.
>
> [cid:image001.png@01D39B71.014E8850]

I don't recoginze "cid:image001.png@01D39B71.014E8850" as an error
message.

Wow.  This is the most bloated sig I've seen in decades...

> Dr. William Sewell
> Direct Line: 385.428.5377  Toll Free: 877.435.7948 ext 5377
> Course Instructor, IT
>
> WGU will be closed President's Day, February 19th.
> Mountain Time Office hours: Sun 3:00 PM - 8:00 PM, Mon 6:30 AM - 3:30 PM, Tue 
> 9:30 AM - 6:30 PM, Wed 9:00 AM - 5:00 PM, Thu 6:30 AM - 3:30 PM
> Your success is very important to me.
> IT MSDA and Database Team
> cmdatab...@wgu.edu
> Toll Free: 1-877-435-7948
> Student Services: 1-866-903-0110
> WellConnect Counseling Services: 1-877-685-3269
> Western Governors University
> mailto:william.sew...@wgu.edu
>
> [WGU]
>
> More about WGU in Fast Company, CNN, NPR, NBC Nightly News, Money, The 
> Atlantic, TIME, etc.
> wgu.edu



-- 
Grant Edwards   grant.b.edwardsYow! Used staples are good
  at   with SOY SAUCE!
  gmail.com

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trace back error just trying to run a simple import of requests

2018-02-01 Thread Steven D'Aprano
On Thu, 01 Feb 2018 20:26:20 +, William Sewell wrote:

> My python script which I run daily just blew up.  So, I went into python
> to diagnose and just typed in the first line - import requests.  I
> received screenfulls of errors.  Why?  What could have happened when
> nothing changed on my end?  

Ah, the infamous "nothing changed, now things have changed!" error.

Computers are deterministic, so something has changed. We may be able to 
help you find out what.


> The traceback is copied below.

If by chance you attached it as a screen shot, please don't:

- screen shots of text are discriminatory against programmers who
  are visually impaired or blind;

- they're also counter-productive, as we don't edit our code with
  photoshop; being able to edit copied text is important;

and most importantly:

- this mailing list is *text only* and blocks all non-text attachments
  (which are nearly always spam and malware), so it can't get through
  to us.

Please copy and paste the text of the traceback and include it in the 
body of your reply (to the list, not to me personally).

If for some reason you genuinely cannot copy the text, which I doubt as 
even Windows supports copy and paste, and you don't mind discriminating 
against the visually impaired, then you can upload the screen shot to an 
image hosting site (one without intrusive ads and malware!) and post the 
URL here. The only one I would use is imgur.


Good luck.



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread jladasky
On Thursday, February 1, 2018 at 9:07:15 AM UTC-8, alister wrote:

> simple solution stop using google groups & use either the mailing list or 
> a news server with an NNTP client

Sigh.  I've been on Usenet since 1986.  Is this how it ends?  I will move if I 
must.

Let me ask those of you who are not using Google Groups: how do you search?  In 
my experience, searching through mailing list archives has been poor.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trace back error just trying to run a simple import of requests

2018-02-01 Thread MRAB

On 2018-02-01 22:32, Grant Edwards wrote:

On 2018-02-01, William Sewell  wrote:


My python script which I run daily just blew up.  So, I went into
python to diagnose and just typed in the first line - import
requests.  I received screenfulls of errors.  Why?  What could have
happened when nothing changed on my end?  The traceback is copied
below.

[cid:image001.png@01D39B71.014E8850]


I don't recoginze "cid:image001.png@01D39B71.014E8850" as an error
message.

Isn't it ironic that we've just had a thread about this very issue, 
namely sending screenshots?


[snip]
--
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Steven D'Aprano
On Thu, 01 Feb 2018 15:48:36 -0800, jladasky wrote:

> Let me ask those of you who are not using Google Groups: how do you
> search?  In my experience, searching through mailing list archives has
> been poor.

https://duckduckgo.com/?q=site%3Amail.python.org+searching+through+mailing+list+archives



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Cameron Simpson

On 01Feb2018 15:48, jlada...@itu.edu  wrote:

On Thursday, February 1, 2018 at 9:07:15 AM UTC-8, alister wrote:

simple solution stop using google groups & use either the mailing list or
a news server with an NNTP client


Sigh.  I've been on Usenet since 1986.  Is this how it ends?  I will move if I 
must.


Might just mean you need to move from letting Google deliver it to you. The 
beauty of usenet is that taking down one provider doesn't break stuff.


 The Net interprets censorship as damage and routes around it.
 - John Gilmore

Let me ask those of you who are not using Google Groups: how do you search?  
In my experience, searching through mailing list archives has been poor.


Well, I cheat. When I join a mailing list I download its archives into my local 
mail store. The I can use whatever I like (currently notmuch) to index and 
search. Locally, even when offline.


I appreciate that this doesn't work form random ad hoc mailing lists I don't 
use, and also that some mailing lists don't present downloadable archives 
(uncivilised IMO).


Otherwise, there is DuckDuckGo and The Google.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Trace back error just trying to run a simple import of requests

2018-02-01 Thread Cameron Simpson

On 01Feb2018 20:26, William Sewell  wrote:

My python script which I run daily just blew up.  So, I went into python to 
diagnose and just typed in the first line - import requests.  I received 
screenfulls of errors.  Why?  What could have happened when nothing changed on 
my end?  The traceback is copied below.


[cid:image001.png@01D39B71.014E8850]


Please followup to the list with a cut/paste of the error text. This list is 
text only and strips attachments as an aid to readability.


We want to help you, but we deal in plain text - it is far more useful to all.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


RE: Trace back error just trying to run a simple import of requests

2018-02-01 Thread William Sewell
It is allright.  I just cannot account for the sudden change.  In my usual path 
everything worked fine.  Now, I have to navigate to where the Python 
executable, even though I have added the path to the Windows path.

Please close my case.


Dr. William Sewell
Direct Line: 385.428.5377  Toll Free: 877.435.7948 ext 5377
Course Instructor, IT

WGU will be closed President's Day, February 19th.
Mountain Time Office hours: Sun 3:00 PM - 8:00 PM, Mon 6:30 AM - 3:30 PM, Tue 
9:30 AM - 6:30 PM, Wed 9:00 AM - 5:00 PM, Thu 6:30 AM - 3:30 PM
Your success is very important to me.  
IT MSDA and Database Team 
cmdatab...@wgu.edu
Toll Free: 1-877-435-7948
Student Services: 1-866-903-0110
WellConnect Counseling Services: 1-877-685-3269
Western Governors University
mailto:william.sew...@wgu.edu



More about WGU in Fast Company, CNN, NPR, NBC Nightly News, Money, The 
Atlantic, TIME, etc.
wgu.edu


-Original Message-
From: Cameron Simpson [mailto:c...@cskk.id.au] 
Sent: Thursday, February 01, 2018 8:08 PM
To: William Sewell 
Cc: python-list@python.org
Subject: Re: Trace back error just trying to run a simple import of requests

On 01Feb2018 20:26, William Sewell  wrote:
>My python script which I run daily just blew up.  So, I went into python to 
>diagnose and just typed in the first line - import requests.  I received 
>screenfulls of errors.  Why?  What could have happened when nothing changed on 
>my end?  The traceback is copied below.
>
>
>[cid:image001.png@01D39B71.014E8850]

Please followup to the list with a cut/paste of the error text. This list is 
text only and strips attachments as an aid to readability.

We want to help you, but we deal in plain text - it is far more useful to all.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trace back error just trying to run a simple import of requests

2018-02-01 Thread Cameron Simpson

On 02Feb2018 02:01, William Sewell  wrote:

It is allright.  I just cannot account for the sudden change.  In my usual path 
everything worked fine.  Now, I have to navigate to where the Python 
executable, even though I have added the path to the Windows path.


Unfortunately I'm not an expert in how Python works on Windows; I gather it is 
rather different an experience from my usual UNIX environment.


I would guess that the requests module is not installed in a place in your 
normal Python's sys.path, but because the current directory is normally a part 
of that, navigating to the Python install area makes the module findable.


You should be able to make it work anywhere with the right Python path setting.  
Hopefully a Windows person can assist with the specifics.



Please close my case.


This is a mailing list! There's no ticket :-) Just idle people prepared to 
help.


Cheers,
Cameron Simpson  (formerly c...@zip.com.au)



Dr. William Sewell
Direct Line: 385.428.5377  Toll Free: 877.435.7948 ext 5377
Course Instructor, IT

WGU will be closed President's Day, February 19th.
Mountain Time Office hours: Sun 3:00 PM - 8:00 PM, Mon 6:30 AM - 3:30 PM, Tue 
9:30 AM - 6:30 PM, Wed 9:00 AM - 5:00 PM, Thu 6:30 AM - 3:30 PM
Your success is very important to me.
IT MSDA and Database Team
cmdatab...@wgu.edu
Toll Free: 1-877-435-7948
Student Services: 1-866-903-0110
WellConnect Counseling Services: 1-877-685-3269
Western Governors University
mailto:william.sew...@wgu.edu



More about WGU in Fast Company, CNN, NPR, NBC Nightly News, Money, The 
Atlantic, TIME, etc.
wgu.edu


-Original Message-
From: Cameron Simpson [mailto:c...@cskk.id.au]
Sent: Thursday, February 01, 2018 8:08 PM
To: William Sewell 
Cc: python-list@python.org
Subject: Re: Trace back error just trying to run a simple import of requests

On 01Feb2018 20:26, William Sewell  wrote:

My python script which I run daily just blew up.  So, I went into python to 
diagnose and just typed in the first line - import requests.  I received 
screenfulls of errors.  Why?  What could have happened when nothing changed on 
my end?  The traceback is copied below.


[cid:image001.png@01D39B71.014E8850]


Please followup to the list with a cut/paste of the error text. This list is 
text only and strips attachments as an aid to readability.

We want to help you, but we deal in plain text - it is far more useful to all.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)

--
https://mail.python.org/mailman/listinfo/python-list


Re: Dependency injection: overriding defaults

2018-02-01 Thread dieter
Kushal Kumaran  writes:

> Victor Porton  writes:
>> dieter wrote:
> ...
>>> I would distinguish between the common library and distinct
>>> applications (command line utility, daemon). The applications
>>> configure the logging system (differently) while the library uses
>>> uniform logging calls.
>>
>> You have essentially just repeated my requirements.
>>
>> But HOW to do this (using dependency_injector module)?
>>
>
> No idea how dependency_injector affects this, but have you read the
> logging howto? The section
> https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
> would be appropriate.

In fact, it was something like this I had in mind.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-01 Thread dieter
nav...@emagevisionpl.com writes:

> I have to make an application in which, 
>
> The user asks a question, Google's API is used to convert the speech to text. 
> But the problem is due to different accent the translator misunderstands the 
> words. 
> I want my application to guess the word to the nearest word spoken by the 
> user. 
> ...
> But sometimes for more than a word it makes the same guess.
> example:
> The user speaks "Light". The system translates it as "Bright"
> The user speaks "White" The system translates it as "Bright"

As those words are phonetically quite apart (they have
very different first consonants), some step in your
processing chain does something seriously wrong.
First thing to do: identify the responsible step. After that,
one can try to find a way to improve on it.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread dieter
jlada...@itu.edu writes:
> ...
> Let me ask those of you who are not using Google Groups: how do you search?  
> In my experience, searching through mailing list archives has been poor.

I am using "gmane.org" which has quite a good search (in my view).
Not sure, whether "gmane.org" hosts "your" newsgroup.

Of course, the service may go away in the future.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-01 Thread Steven D'Aprano
On Fri, 02 Feb 2018 08:14:03 +0100, dieter wrote:

>> The user speaks "Light". The system translates it as "Bright" The user
>> speaks "White" The system translates it as "Bright"
> 
> As those words are phonetically quite apart (they have very different
> first consonants), some step in your processing chain does something
> seriously wrong.

I disagree: Light, Bright and White sound very similar. They're identical 
except for the first consonant:

/laɪt/
/bɹaɪt/
/waɪt/

and even those consonants sound very similar. Human beings can easily 
mishear or fail to distinguish between those words, e.g.:

https://www.wordnik.com/words/we%20tripped%20a%20light%20fan%20dangle

https://duckduckgo.com/?q=%22brighter+shade+of+pale%22+mondegreen


(the name of the song is *Whiter* Shade of Pale, not "Lighter" or 
"Brighter"). We should not assume that the first consonant is always 
correct.

Of course we would hope that a speech-to-text system would correctly 
match Light/Bright/White/Fright/etc but given the vagaries of human 
accents and pronunciation, we shouldn't be surprised if it sometimes gets 
them wrong.



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list