[Application-profiles-ig] Python implementation(s)

Phil Barker phil.barker at pjjk.co.uk
Tue Dec 8 10:08:53 GMT 2020


我猜这意味着默认默认是假的:) That's probably a good reason for setting a default value in the spec. Phil On 07/12/2020 19:23, Karen Coyle wrote: >Does any of this mean that a profile that does not defined mandatory>or repeatable will be given a default of "false"? That would mean not>mandatory and not repeatable. For columns with string values, this>would be interpreted as "missing" and applications could fill in their>own defaults, but for the Boolean values there wouldn't be a>difference between an affirmative "mandatory = no" and the>Python-assigned default.>>kc>>On 12/7/20 10:28 AM, Phil Barker wrote:>>(I'm still looking at dict objects Vs object properties, but in the>>meantime...)>>>>On 05/12/2020 14:24, Thomas Baker wrote:>>>A question for you (or Nishad): do you happen to know>>>what difference it makes -- in the case of dataclasses>>>designed to be populated from CSV files (ie, with string>>>values) -- whether the default value should be an empty>>>string, None or even, in some cases, False?>>>>>>@dataclass>>>class CSVTripleConstraint:>>>...>>>mandatory: str = "">>>mandatory: str = None>>>mandatory: str = False>>>>>>bool() evaluates all three to False, but perhaps one way>>>is more pythonic, or perhaps there are hidden gotchas with>>>one or the other?>>>>Does the default behaviour of python help? In the python console:>>>>Python 3.8.5 (default, Jul 28 2020, 12:59:40)>>[GCC 9.3.0] on linux>>Type "help", "copyright", "credits" or "license" for more information.>>>>> s = str()>>>>> s>>''>>>>> type(s)>>>>>>> s: str = None>>>>> s>>>>> type(s)>>>>>>>>>>>If you're using type hints, I guess it's useful to start with>>something that is the right type.>>>>Phil>>>>-->>>>Phil Barker <http://people.pjjk.net/phil>.http://people.pjjk.net/phil>>CETIS LLP <https://www.cetis.org.uk>: a cooperative consultancy for>>innovation in education technology.>>PJJK Limited <https://www.pjjk.co.uk>: technology to enhance>>learning; information systems for education.>>>>CETIS is a co-operative limited liability partnership, registered in>>England number OC399090>>PJJK Limited is registered in Scotland as a private limited company,>>number SC569282.>>>-- Phil Barker <http://people.pjjk.net/phil>.http://people.pjjk.net/philCETIS LLP <https://www.cetis.org.uk>: a cooperative consultancy for innovation in education technology. PJJK Limited <https://www.pjjk.co.uk>: technology to enhance learning; information systems for education. CETIS is a co-operative limited liability partnership, registered in England number OC399090 PJJK Limited is registered in Scotland as a private limited company, number SC569282. -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.www.voudr.com/pipermail/application-profiles-ig/attachments/20201208/1d62fd7f/attachment.htm>


More information about the Application-profiles-ig mailing list