You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/22 23:55:12 UTC

[GitHub] anirudhacharya commented on a change in pull request #12291: [MXNET-817] Fixes to speech recognition example

anirudhacharya commented on a change in pull request #12291: [MXNET-817] Fixes to speech recognition example
URL: https://github.com/apache/incubator-mxnet/pull/12291#discussion_r212138807
 
 

 ##########
 File path: example/speech_recognition/singleton.py
 ##########
 @@ -32,7 +32,7 @@ def getInstance(self):
 
     def __new__(class_, *args, **kwargs):
         print("__new__")
-        class_.instances[class_] = super(Singleton, class_).__new__(class_, *args, **kwargs)
+        class_.instances[class_] = super().__new__(class_, *args, **kwargs)
 
 Review comment:
   why remove passing `Singleton` and `class_` while calling `super`?
   
   Typo in line 42, should be `SingletonInstance`.
   line 52 in redundant.
   The whole `SingletonInstance` class defined in line 42 is redundant. It is not being used anywhere. I think it can be removed.
   
   In fact in this whole speech recognition example, the code around the use of singletons can be refactored. The `Singleton` class defined in line 21 is used only once as a decorator in `label_util.py` module. 
   
   The `log_util.py` module again defines another class called `SingletonType` which is used to make `LogUtil` class a singleton. There is duplication of code and logic here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services