这可以按预期工作,但我不确定这种方法。安全吗?它是pythonic吗?
onAdClicked
(如果Python2和Python3之间有任何区别,我只使用Python3。)
答案 0 :(得分:4)
这非常令人困惑。如果其他人读了它,他们就不会理解发生了什么。只需在方法的开头加上E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.creceactivaciones.itecandroidice.app, PID: 11065
java.lang.RuntimeException: Unable to resume activity {com.creceactivaciones.itecandroidice.app/com.creceactivaciones.itecandroidice.app.Serie}: java.lang.IllegalArgumentException: the bind value at index 5 is null
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2964)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2993)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: the bind value at index 5 is null
at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:164)
at android.database.sqlite.SQLiteProgram.bindAllArgsAsStrings(SQLiteProgram.java:200)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1339)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1278)
at com.creceactivaciones.itecandroidice.app.dbManager.Series_Promotores(dbManager.java:1231)
at com.creceactivaciones.itecandroidice.app.Serie.onResume(Serie.java:127)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1197)
at android.app.Activity.performResume(Activity.java:5343)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2950)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2993)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
语句。
if
此外,如果您在使用def calc(self, x):
if self.parameter == 0:
return 0
# ... long calculation of result ...
return result
初始化后更改self.parameter
,则您的功能将不再有效。
答案 1 :(得分:3)
如果class Example:
def __init__(self, parameter):
self._parameter = parameter
def calc(self, x):
if not self._parameter:
return 0.0
# ... long calculation of result ...
return result
发生变化,你会遇到问题,所以我不认为这是一个好习惯。
相反,我认为你应该这样做:
\$inject = \[('([\w]+)'([,]?[\s]?))*
答案 2 :(得分:0)
我决定发布一些评论和答案的摘要。请不要对此摘要投票,而是给原作者+1,。
parameters:
class_name: AppBundle\Entity|Product
%class_name%
用于简单的情况:__methods__