সরবরাহিত উত্তরের অনেকগুলি সম্পত্তির জন্য অনেকগুলি লাইন প্রয়োজন, অর্থাত্ / এবং / অথবা - একাধিক সম্পত্তির জন্য পুনরাবৃত্তির কারণে আমি কী কুৎসিত বা ক্লান্তিকর প্রয়োগ বিবেচনা করি, ইত্যাদি। আমি ফুটন্ত জিনিসগুলি নীচে রেখে / সরানো পর্যন্ত তাদের পছন্দ করি আর সরল করা যায় না যতক্ষণ না এটি এটি করার জন্য বেশি উদ্দেশ্য করে না।
সংক্ষেপে: সমাপ্ত কাজগুলিতে, আমি যদি কোডের 2 লাইনের পুনরাবৃত্তি করি, তবে আমি সাধারণত এটিকে একটি একক লাইন সহায়ক ফাংশনে রূপান্তর করি এবং তাই ... আমি গণিত বা বিজোড় যুক্তিগুলি (স্টার্ট_এক্স, স্টার্ট_ই, এন্ড_ এক্স, এন্ড_ই) এর মতো করে সরলীকৃত করি (x, y, w, h) অর্থাত্ x, y, x + w, y + h (কখনও কখনও নূন্যতম / সর্বোচ্চ প্রয়োজন হয় বা যদি ডাব্লু / ঘন্টা নেতিবাচক থাকে এবং বাস্তবায়ন পছন্দ না করে, আমি এক্স / থেকে বিয়োগ করব) y এবং অ্যাবস ডাব্লু / এইচ। ইত্যাদি।)।
অভ্যন্তরীণ getters / setters ওভাররাইড করা একটি ভাল উপায়, কিন্তু সমস্যা আপনি প্রতিটি ক্লাসের জন্য যে প্রয়োজন, বা ক্লাস যে বেসে পিতামাতার ... এটি আমার পক্ষে কাজ করবে না কারণ আমি পছন্দ করব উত্তরাধিকার, শিশু নোড ইত্যাদির জন্য বাচ্চাদের / পিতামাতাদের চয়ন করতে বিনামূল্যে
আমি একটি সমাধান তৈরি করেছি যা ডেটা সরবরাহের জন্য ডিক্ট ডেটা-টাইপ ব্যবহার না করেই প্রশ্নের উত্তর দেয় কারণ আমি দেখতে পেয়েছি যে ডেটা প্রবেশ করানো ক্লান্তিকর হতে পারে ইত্যাদি ...
আমার সমাধানটিতে আপনার শ্রেণীর উপরে 2 টি অতিরিক্ত লাইন যুক্ত করা দরকার যা আপনি যে শ্রেণীর বৈশিষ্ট্যগুলিতে যুক্ত করতে চান তার জন্য বেস বর্গ তৈরি করতে হবে, তারপরে 1 লাইন এবং আপনার কাছে ডেটা নিয়ন্ত্রণের জন্য কলব্যাক যুক্ত করার সুযোগ রয়েছে, ডেটা পরিবর্তন হলে আপনাকে অবহিত করবেন , মান এবং / অথবা ডেটা-টাইপ এবং আরও অনেক কিছুর উপর ভিত্তি করে সেট করা যেতে পারে এমন ডেটা সীমাবদ্ধ করুন।
আপনার কাছে _object.x, _object.x = মান, _object.GetX (), _object.SetX (মান) ব্যবহার করার বিকল্প রয়েছে এবং সেগুলি সমানভাবে পরিচালিত হয়।
তদ্ব্যতীত, মানগুলি হ'ল একমাত্র স্থিতিশীল ডেটা যা শ্রেণীর উদাহরণ হিসাবে বরাদ্দ করা হয়, তবে আসল সম্পত্তি শ্রেণীর কাছে বরাদ্দ করা হয় যার অর্থ আপনি পুনরাবৃত্তি করতে চান না, পুনরাবৃত্তি করার দরকার নেই ... আপনি একটি ডিফল্ট মান বরাদ্দ করতে পারে তাই প্রতিবার গ্রাহকের এটির প্রয়োজন হয় না, যদিও সেখানে ডিফল্ট ডিফল্ট মানকে ওভাররাইড করার জন্য একটি বিকল্প রয়েছে এবং সেখানে আরও একটি বিকল্প রয়েছে যাতে গ্রাহক ডিফল্ট রিটার্নগুলিকে ওভাররাইড করে কাঁচা সঞ্চিত মান ফেরত দেয় (দ্রষ্টব্য: এই পদ্ধতিটি মানে কাঁচা মান কেবল তখনই নির্ধারিত হয় যখন কোনও মান নির্ধারিত হয়, অন্যথায় এটি কোনওটিই নয় - যখন মানটি পুনরায় সেট করা হয়, তখন এটি কোনও কিছুই বরাদ্দ করে না))
অনেক সাহায্যকারী ফাংশনও রয়েছে - প্রথম সম্পত্তি যা যুক্ত হয় উদাহরণের মানগুলি উল্লেখ করার জন্য ক্লাসে 2 বা আরও সাহায্যকারী যুক্ত করে ... সেগুলি রিসেটএ্যাকসেসর (_কি, ..) পুনরাবৃত্তি হয় (সমস্ত প্রথম নামযুক্ত আরোগুলি ব্যবহার করে পুনরাবৃত্তি করা যেতে পারে) ) এবং সেটএ্যাক্সেসরস (_কি, _ভ্যালু) দক্ষতার সহায়তায় মূল শ্রেণিতে আরও যুক্ত হওয়ার বিকল্প রয়েছে - পরিকল্পনা করা পরিকল্পনাগুলি হ'ল একসাথে গ্রুপ অ্যাক্সেসরদের উপায়, তাই যদি আপনি একবারে কয়েকটি রিসেট করতে চান তবে , আপনি তাদের একটি গোষ্ঠীতে অর্পণ করতে পারেন এবং প্রতিবার নামযুক্ত কীগুলি পুনরাবৃত্তি করার পরিবর্তে এবং আরও অনেক কিছুতে গ্রুপটি পুনরায় সেট করতে পারেন।
উদাহরণ / কাঁচা সঞ্চিত মান শ্রেণিতে সঞ্চয় করা হয় । , শ্রেণী. অ্যাকসেসর ক্লাসটি রেফারেন্স করে যা সম্পত্তির জন্য স্ট্যাটিক ওয়ার্স / মান / ফাংশন ধারণ করে। _class। সে সম্পত্তি যা সেটিং / প্রাপ্তি ইত্যাদির সময় উদাহরণ শ্রেণীর মাধ্যমে অ্যাক্সেস করার সময় বলা হয় property
অ্যাক্সেসর _ক্লাস .__ শ্রেণিতে নির্দেশ করে, তবে এটি অভ্যন্তরীণ হওয়ায় এটি ক্লাসে নির্ধারিত হওয়া দরকার যার কারণে আমি এটি নির্ধারণ করতে __Name = AccessorFunc (...) ব্যবহার করতে পছন্দ করেছি, অনেকগুলি optionচ্ছিক সহ সম্পত্তি প্রতি একক লাইন আর্গুমেন্টগুলি ব্যবহার করার জন্য (কীড ভেরাগগুলি ব্যবহার করে কারণ তারা সনাক্তকরণ এবং বজায় রাখতে আরও সহজ এবং দক্ষ))
আমি উল্লিখিত হিসাবে অনেকগুলি ফাংশনও তৈরি করি, যার মধ্যে কিছু অ্যাকসেসর ফাংশন তথ্য ব্যবহার করে তাই এটির কল করার দরকার নেই (এই মুহুর্তে এটি কিছুটা অসুবিধে হয় - ঠিক এখন আপনাকে _ক্লাস ব্যবহার করা দরকার un ফাংশননাম (_ক্লাস_ইনস্ট্যান্স) , আরগস) - স্ট্যাক / ট্রেসটি ব্যবহার করে আমি এই বিট ম্যারাথনটি চালিত ফাংশনগুলি যোগ করে, বা বস্তুটিতে অ্যাকসেসর যুক্ত করে এবং স্ব ব্যবহার করে (এটি চিহ্নিত করার জন্য এটির নামকরণ করেছি) উদাহরণটি উল্লেখ করে রেফারেন্সটি দখল করার জন্য দখল করেছিলাম they 'উদাহরণ স্বরূপ এবং পুনরায় অ্যাক্সেস ধরে রাখতে, অ্যাক্সেসরফঙ্ক ক্লাসের রেফারেন্স এবং ফাংশন সংজ্ঞাগুলির মধ্যে থেকে অন্যান্য তথ্য)।
এটি পুরোপুরি সম্পন্ন হয় নি, তবে এটি একটি দুর্দান্ত পাদদেশ। দ্রষ্টব্য: আপনি যদি বৈশিষ্ট্য তৈরি করতে __Name = অ্যাক্সেসরফঙ্ক (...) ব্যবহার না করেন তবে আপনার __ কীতে অ্যাক্সেস থাকবে না যদিও আমি এটি ডিআই ফাংশনের মধ্যে সংজ্ঞায়িত করেছি। আপনি যদি করেন তবে কোনও সমস্যা নেই।
এছাড়াও: দ্রষ্টব্য যে নাম এবং কী আলাদা ... নামটি 'ফর্মাল', যা ফাংশন নাম তৈরিতে ব্যবহৃত হয়, এবং কীটি ডেটা স্টোরেজ এবং অ্যাক্সেসের জন্য। যেমন _class.x যেখানে ছোট হাতের অক্ষর কী হয়, নামটি বড় হাতের এক্স হবে যাতে গেটএক্সের পরিবর্তে গেটএক্স () ফাংশন যা কিছুটা বিশ্রী দেখায়। এটি সেলফ.এক্সকে কাজ করতে এবং উপযুক্ত দেখাতে দেয়, তবে গেটএক্স () কে অনুমতি দেয় এবং উপযুক্ত দেখায়।
আমি কী / নামের অভিন্ন, এবং দেখানোর জন্য পৃথক সহ একটি উদাহরণ বর্গ স্থাপন করেছি। ডেটা আউটপুট দেওয়ার জন্য তৈরি অনেক সহায়ক ফাংশন (দ্রষ্টব্য: এগুলি সমস্ত সম্পূর্ণ নয়) যাতে আপনি দেখতে পাচ্ছেন কী চলছে।
কী ব্যবহার করে ফাংশনগুলির বর্তমান তালিকা: এক্স, নাম: এক্স আউটপুট হিসাবে:
এটি কোনওভাবেই একটি বিস্তৃত তালিকা নয় - এমন কয়েকটি আছে যা পোস্ট করার সময় এটি তৈরি করে নি ...
_instance.SetAccessors( _key, _value [ , _key, _value ] .. ) Instance Class Helper Function: Allows assigning many keys / values on a single line - useful for initial setup, or to minimize lines. In short: Calls this.Set<Name>( _value ) for each _key / _value pairing.
_instance.ResetAccessors( _key [ , _key ] .. ) Instance Class Helper Function: Allows resetting many key stored values to None on a single line. In short: Calls this.Reset<Name>() for each name provided.
Note: Functions below may list self.Get / Set / Name( _args ) - self is meant as the class instance reference in the cases below - coded as this in AccessorFuncBase Class.
this.GetX( _default_override = None, _ignore_defaults = False ) GET: Returns IF ISSET: STORED_VALUE .. IF IGNORE_DEFAULTS: None .. IF PROVIDED: DEFAULT_OVERRIDE ELSE: DEFAULT_VALUE 100
this.GetXRaw( ) RAW: Returns STORED_VALUE 100
this.IsXSet( ) ISSET: Returns ( STORED_VALUE != None ) True
this.GetXToString( ) GETSTR: Returns str( GET ) 100
this.GetXLen( _default_override = None, _ignore_defaults = False ) LEN: Returns len( GET ) 3
this.GetXLenToString( _default_override = None, _ignore_defaults = False ) LENSTR: Returns str( len( GET ) ) 3
this.GetXDefaultValue( ) DEFAULT: Returns DEFAULT_VALUE 1111
this.GetXAccessor( ) ACCESSOR: Returns ACCESSOR_REF ( self.__<key> ) [ AccessorFuncBase ] Key: x : Class ID: 2231452344344 : self ID: 2231448283848 Default: 1111 Allowed Types: {"<class 'int'>": "<class 'type'>", "<class 'float'>": "<class 'type'>"} Allowed Values: None
this.GetXAllowedTypes( ) ALLOWED_TYPES: Returns Allowed Data-Types {"<class 'int'>": "<class 'type'>", "<class 'float'>": "<class 'type'>"}
this.GetXAllowedValues( ) ALLOWED_VALUES: Returns Allowed Values None
this.GetXHelpers( ) HELPERS: Returns Helper Functions String List - ie what you're reading now... THESE ROWS OF TEXT
this.GetXKeyOutput( ) Returns information about this Name / Key ROWS OF TEXT
this.GetXGetterOutput( ) Returns information about this Name / Key ROWS OF TEXT
this.SetX( _value ) SET: STORED_VALUE Setter - ie Redirect to __<Key>.Set N / A
this.ResetX( ) RESET: Resets STORED_VALUE to None N / A
this.HasXGetterPrefix( ) Returns Whether or Not this key has a Getter Prefix... True
this.GetXGetterPrefix( ) Returns Getter Prefix... Get
this.GetXName( ) Returns Accessor Name - Typically Formal / Title-Case X
this.GetXKey( ) Returns Accessor Property Key - Typically Lower-Case x
this.GetXAccessorKey( ) Returns Accessor Key - This is to access internal functions, and static data... __x
this.GetXDataKey( ) Returns Accessor Data-Storage Key - This is the location where the class instance value is stored.. _x
আউটপুট হচ্ছে এমন কিছু ডেটা হ'ল:
নাম ব্যতীত অন্য কোনও ডেটা ছাড়াই ডেমো ক্লাস ব্যবহার করে তৈরি করা একেবারে নতুন শ্রেণীর জন্য এটি (যাতে এটি আউটপুট হতে পারে) যা _ফু, আমি যে পরিবর্তনশীল নামটি ব্যবহার করেছি ...
_foo --- MyClass: ---- id( this.__class__ ): 2231452349064 :::: id( this ): 2231448475016
Key Getter Value | Raw Key Raw / Stored Value | Get Default Value Default Value | Get Allowed Types Allowed Types | Get Allowed Values Allowed Values |
Name: _foo | _Name: _foo | __Name.DefaultValue( ): AccessorFuncDemoClass | __Name.GetAllowedTypes( ) <class 'str'> | __Name.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
x: 1111 | _x: None | __x.DefaultValue( ): 1111 | __x.GetAllowedTypes( ) (<class 'int'>, <class 'float'>) | __x.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
y: 2222 | _y: None | __y.DefaultValue( ): 2222 | __y.GetAllowedTypes( ) (<class 'int'>, <class 'float'>) | __y.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
z: 3333 | _z: None | __z.DefaultValue( ): 3333 | __z.GetAllowedTypes( ) (<class 'int'>, <class 'float'>) | __z.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
Blah: <class 'int'> | _Blah: None | __Blah.DefaultValue( ): <class 'int'> | __Blah.GetAllowedTypes( ) <class 'str'> | __Blah.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
Width: 1 | _Width: None | __Width.DefaultValue( ): 1 | __Width.GetAllowedTypes( ) (<class 'int'>, <class 'bool'>) | __Width.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
Height: 0 | _Height: None | __Height.DefaultValue( ): 0 | __Height.GetAllowedTypes( ) <class 'int'> | __Height.GetAllowedValues( ) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
Depth: 2 | _Depth: None | __Depth.DefaultValue( ): 2 | __Depth.GetAllowedTypes( ) Saved Value Restricted to Authorized Values ONLY | __Depth.GetAllowedValues( ) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
this.IsNameSet( ): True this.GetName( ): _foo this.GetNameRaw( ): _foo this.GetNameDefaultValue( ): AccessorFuncDemoClass this.GetNameLen( ): 4 this.HasNameGetterPrefix( ): <class 'str'> this.GetNameGetterPrefix( ): None
this.IsXSet( ): False this.GetX( ): 1111 this.GetXRaw( ): None this.GetXDefaultValue( ): 1111 this.GetXLen( ): 4 this.HasXGetterPrefix( ): (<class 'int'>, <class 'float'>) this.GetXGetterPrefix( ): None
this.IsYSet( ): False this.GetY( ): 2222 this.GetYRaw( ): None this.GetYDefaultValue( ): 2222 this.GetYLen( ): 4 this.HasYGetterPrefix( ): (<class 'int'>, <class 'float'>) this.GetYGetterPrefix( ): None
this.IsZSet( ): False this.GetZ( ): 3333 this.GetZRaw( ): None this.GetZDefaultValue( ): 3333 this.GetZLen( ): 4 this.HasZGetterPrefix( ): (<class 'int'>, <class 'float'>) this.GetZGetterPrefix( ): None
this.IsBlahSet( ): False this.GetBlah( ): <class 'int'> this.GetBlahRaw( ): None this.GetBlahDefaultValue( ): <class 'int'> this.GetBlahLen( ): 13 this.HasBlahGetterPrefix( ): <class 'str'> this.GetBlahGetterPrefix( ): None
this.IsWidthSet( ): False this.GetWidth( ): 1 this.GetWidthRaw( ): None this.GetWidthDefaultValue( ): 1 this.GetWidthLen( ): 1 this.HasWidthGetterPrefix( ): (<class 'int'>, <class 'bool'>) this.GetWidthGetterPrefix( ): None
this.IsDepthSet( ): False this.GetDepth( ): 2 this.GetDepthRaw( ): None this.GetDepthDefaultValue( ): 2 this.GetDepthLen( ): 1 this.HasDepthGetterPrefix( ): None this.GetDepthGetterPrefix( ): (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
this.IsHeightSet( ): False this.GetHeight( ): 0 this.GetHeightRaw( ): None this.GetHeightDefaultValue( ): 0 this.GetHeightLen( ): 1 this.HasHeightGetterPrefix( ): <class 'int'> this.GetHeightGetterPrefix( ): (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
এবং এটি একই _ ক্রমে নিম্নোক্ত মানগুলি (নাম বাদে) প্রদানের পরে: 'স্ট্রিং', 1.0, সত্য, 9, 10, মিথ্যা
this.IsNameSet( ): True this.GetName( ): _foo this.GetNameRaw( ): _foo this.GetNameDefaultValue( ): AccessorFuncDemoClass this.GetNameLen( ): 4 this.HasNameGetterPrefix( ): <class 'str'> this.GetNameGetterPrefix( ): None
this.IsXSet( ): True this.GetX( ): 10 this.GetXRaw( ): 10 this.GetXDefaultValue( ): 1111 this.GetXLen( ): 2 this.HasXGetterPrefix( ): (<class 'int'>, <class 'float'>) this.GetXGetterPrefix( ): None
this.IsYSet( ): True this.GetY( ): 10 this.GetYRaw( ): 10 this.GetYDefaultValue( ): 2222 this.GetYLen( ): 2 this.HasYGetterPrefix( ): (<class 'int'>, <class 'float'>) this.GetYGetterPrefix( ): None
this.IsZSet( ): True this.GetZ( ): 10 this.GetZRaw( ): 10 this.GetZDefaultValue( ): 3333 this.GetZLen( ): 2 this.HasZGetterPrefix( ): (<class 'int'>, <class 'float'>) this.GetZGetterPrefix( ): None
this.IsBlahSet( ): True this.GetBlah( ): string Blah this.GetBlahRaw( ): string Blah this.GetBlahDefaultValue( ): <class 'int'> this.GetBlahLen( ): 11 this.HasBlahGetterPrefix( ): <class 'str'> this.GetBlahGetterPrefix( ): None
this.IsWidthSet( ): True this.GetWidth( ): False this.GetWidthRaw( ): False this.GetWidthDefaultValue( ): 1 this.GetWidthLen( ): 5 this.HasWidthGetterPrefix( ): (<class 'int'>, <class 'bool'>) this.GetWidthGetterPrefix( ): None
this.IsDepthSet( ): True this.GetDepth( ): 9 this.GetDepthRaw( ): 9 this.GetDepthDefaultValue( ): 2 this.GetDepthLen( ): 1 this.HasDepthGetterPrefix( ): None this.GetDepthGetterPrefix( ): (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
this.IsHeightSet( ): True this.GetHeight( ): 9 this.GetHeightRaw( ): 9 this.GetHeightDefaultValue( ): 0 this.GetHeightLen( ): 1 this.HasHeightGetterPrefix( ): <class 'int'> this.GetHeightGetterPrefix( ): (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
_foo --- MyClass: ---- id( this.__class__ ): 2231452349064 :::: id( this ): 2231448475016
Key Getter Value | Raw Key Raw / Stored Value | Get Default Value Default Value | Get Allowed Types Allowed Types | Get Allowed Values Allowed Values |
Name: _foo | _Name: _foo | __Name.DefaultValue( ): AccessorFuncDemoClass | __Name.GetAllowedTypes( ) <class 'str'> | __Name.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
x: 10 | _x: 10 | __x.DefaultValue( ): 1111 | __x.GetAllowedTypes( ) (<class 'int'>, <class 'float'>) | __x.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
y: 10 | _y: 10 | __y.DefaultValue( ): 2222 | __y.GetAllowedTypes( ) (<class 'int'>, <class 'float'>) | __y.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
z: 10 | _z: 10 | __z.DefaultValue( ): 3333 | __z.GetAllowedTypes( ) (<class 'int'>, <class 'float'>) | __z.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
Blah: string Blah | _Blah: string Blah | __Blah.DefaultValue( ): <class 'int'> | __Blah.GetAllowedTypes( ) <class 'str'> | __Blah.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
Width: False | _Width: False | __Width.DefaultValue( ): 1 | __Width.GetAllowedTypes( ) (<class 'int'>, <class 'bool'>) | __Width.GetAllowedValues( ) Saved Value Restrictions Levied by Data-Type |
Height: 9 | _Height: 9 | __Height.DefaultValue( ): 0 | __Height.GetAllowedTypes( ) <class 'int'> | __Height.GetAllowedValues( ) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
Depth: 9 | _Depth: 9 | __Depth.DefaultValue( ): 2 | __Depth.GetAllowedTypes( ) Saved Value Restricted to Authorized Values ONLY | __Depth.GetAllowedValues( ) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
নোট করুন যে সীমাবদ্ধ ডেটা-প্রকার বা মান সীমাবদ্ধতার কারণে কিছু ডেটা বরাদ্দ করা হয়নি - এটি নকশা দ্বারা। ডিফল্ট মান হিসাবে নির্ধারিত হওয়া (এমনকি আপনি যদি ডিফল্ট মান সুরক্ষা আচরণকে ওভাররাইড না করেন) সেটারটি খারাপ ডেটা-প্রকার বা মানকে নির্ধারিত হতে বাধা দেয়)
কোডটি এখানে পোস্ট করা হয়নি কারণ উদাহরণ এবং ব্যাখ্যাগুলির পরে আমার কাছে জায়গা ছিল না ... এছাড়াও কারণ এটি পরিবর্তন হবে।
দয়া করে নোট করুন: এই পোস্টিংয়ের সময় ফাইলটি অগোছালো - এটি পরিবর্তন হবে। তবে, আপনি যদি এটি সাব্লাইম পাঠ্যে চালনা করেন এবং এটি সংকলন করেন বা পাইথন থেকে চালনা করেন তবে এটি এক টন তথ্য সংকলন এবং থুতু ছুঁড়ে দেবে - অ্যাক্সেসরডিবি অংশটি সম্পন্ন হয়নি (যা প্রিন্ট গেটার্স এবং গেটকি আউটপুট সহায়কটি আপডেট করতে ব্যবহৃত হবে) ইনস্ট্যান্স ফাংশনে পরিবর্তিত হওয়ার সাথে সাথে ফাংশনগুলি সম্ভবত একক ফাংশনে রেখে নতুন নামকরণ করা হয়েছে - এটি দেখুন ..)
পরবর্তী: এটি চালানোর জন্য সমস্ত কিছুর প্রয়োজন হয় না - নীচের অংশে প্রচুর মন্তব্য করা জিনিসগুলি ডিবাগিংয়ের জন্য ব্যবহৃত আরও তথ্যের জন্য - আপনি এটি ডাউনলোড করার সময় এটি নাও থাকতে পারে। যদি তা হয় তবে আপনার আরও তথ্যের জন্য অসুবিধা এবং পুনরায় সংযোগ করতে সক্ষম হওয়া উচিত।
আমি মাইক্লাসবেস: পাস, মাইক্লাস (মাইক্লাসবেস) প্রয়োজনের জন্য প্রায় একটি কাজের সন্ধান করছি: ... - যদি আপনি কোনও সমাধানের বিষয়টি জানেন তবে পোস্ট করুন।
ক্লাসে প্রয়োজনীয় জিনিসগুলির মধ্যে __ লাইনগুলি - স্ট্রিং ডিবাগিংয়ের জন্য যেমন ডিআইপি - সেগুলি ডেমো ক্লাস থেকে সরানো যেতে পারে তবে আপনাকে নীচের কিছু লাইন মন্তব্য করতে বা মুছে ফেলতে হবে (_ফু / ২ / 3 ) ..
শীর্ষে স্ট্রিং, ডিক্ট এবং ইউটিল ক্লাসগুলি আমার পাইথন লাইব্রেরির একটি অংশ - সেগুলি সম্পূর্ণ নয়। আমি লাইব্রেরি থেকে আমার প্রয়োজনীয় কয়েকটি জিনিসের অনুলিপি করেছি এবং আমি কয়েকটি নতুন তৈরি করেছি। সম্পূর্ণ কোডটি সম্পূর্ণ লাইব্রেরির সাথে লিঙ্ক করবে এবং এটি আপডেট কল সরবরাহ এবং কোডটি সরিয়ে দেওয়ার সাথে অন্তর্ভুক্ত করবে (আসলে, কেবলমাত্র একমাত্র কোডটি ডেমো ক্লাস এবং মুদ্রণ বিবৃতি হবে - অ্যাকসেসরফঙ্ক সিস্টেমটি লাইব্রেরিতে স্থানান্তরিত হবে)। ..
ফাইলের অংশ:
##
## MyClass Test AccessorFunc Implementation for Dynamic 1-line Parameters
##
class AccessorFuncDemoClassBase( ):
pass
class AccessorFuncDemoClass( AccessorFuncDemoClassBase ):
__Name = AccessorFuncBase( parent = AccessorFuncDemoClassBase, name = 'Name', default = 'AccessorFuncDemoClass', allowed_types = ( TYPE_STRING ), allowed_values = VALUE_ANY, documentation = 'Name Docs', getter_prefix = 'Get', key = 'Name', allow_erroneous_default = False, options = { } )
__x = AccessorFuncBase( parent = AccessorFuncDemoClassBase, name = 'X', default = 1111, allowed_types = ( TYPE_INTEGER, TYPE_FLOAT ), allowed_values = VALUE_ANY, documentation = 'X Docs', getter_prefix = 'Get', key = 'x', allow_erroneous_default = False, options = { } )
__Height = AccessorFuncBase( parent = AccessorFuncDemoClassBase, name = 'Height', default = 0, allowed_types = TYPE_INTEGER, allowed_values = VALUE_SINGLE_DIGITS, documentation = 'Height Docs', getter_prefix = 'Get', key = 'Height', allow_erroneous_default = False, options = { } )
এই সৌন্দর্য অ্যাক্সেসরফঙ্কস / কলব্যাকস / ডেটা-টাইপ / মান প্রয়োগকরণ ইত্যাদির সাথে গতিযুক্ত যুক্ত বৈশিষ্ট্য সহ নতুন ক্লাস তৈরি করা অবিশ্বাস্যরকম সহজ করে তোলে
আপাতত, লিঙ্কটি এখানে রয়েছে (এই লিঙ্কটি নথির পরিবর্তনগুলি প্রতিবিম্বিত করা উচিত)): https : //www.DPboxboxss/6gzi44i7dh58v61/dynamic_properties_accessorfuncs_and_more.py?dl=0
এছাড়াও: আপনি যদি সাব্লাইম টেক্সট ব্যবহার না করেন তবে আমি নোটপ্যাড ++, পরমাণু, ভিজ্যুয়াল কোড এবং অন্যদের উপরে এটির সুপারিশ করছি কারণ সঠিক থ্রেডিং প্রয়োগকরণ এটি ব্যবহার করার চেয়ে আরও দ্রুত তৈরি করেছে ... আমি আইডিই-জাতীয় কোডেও কাজ করছি এর জন্য ম্যাপিং সিস্টেম - একবার দেখুন: https://bitbucket.org/Acecool/acecoolcodemappingsystem/src/master/ (প্রথমে প্যাকেজ ম্যানেজারে রেপো যুক্ত করুন, তারপরে প্লাগইন ইনস্টল করুন - যখন সংস্করণ 1.0.0 প্রস্তুত হবে, আমি যুক্ত করব এটি মূল প্লাগইন তালিকায় ...)
আমি আশা করি এই সমাধানটি সর্বদা হিসাবে ... এবং, সহায়তা করে:
এটি কাজ করে বলে, এটি সঠিক করে না - জোশ 'এস্কুল' মোজার r
:
এবং__init__
রেফারেন্স প্রয়োজনself.fn_readyonly
।