question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing duplicate (with deep_copy bool) function for Dictionary

See original GitHub issue

Hello!

Duplicate(deep = false) I’m currently missing the duplicate function (with deep_copy functionalities) in the godot.core.Dictionary.

keys and values? Also I’m not really sure about the implementation of keys and values as they currently seem much too close to being actual fields in the Dictionary? Like for example if I have following Dictionary dict:

{
"keys" : ["pear", "banana", "apple"],
"values": ["diamond", "pearl", "amethyst"]
}

I would expect dict.keys to give me a GDArray of [“pear”, “banana”, “apple”] instead of a GDArray of [“keys”, “values”]? Currently this isn’t the case and this might confuse adapters coming from GDScript. (I am aware that you can still use dict[“keys”] and that will work… but the confusion can be avoided!)

list<String> and array<String> to PoolStringArray There’s a lot of other functionalities missing but having a conversion between list<String> and PoolStringArray (as well as other lists<>/array<> to their respective Godot arrays) would be great to have.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
chippmanncommented, Mar 3, 2020

Changed the label from beta release to production release as the most important functions are added for the beta release. The other functions are delivered in another beta version or the final release.

0reactions
chippmanncommented, Mar 22, 2020

Closing in favor of the merge. After the merge, there should be no functions missing, because the setup for the cinterop works differently. I some functions are desperately needed until then, feel free to reopen it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to copy a dictionary and only edit the copy - Stack Overflow
To copy the mutable types like dictionaries, use copy / deepcopy of the copy module. import copy dict2 = copy.deepcopy(dict1). Share.
Read more >
Shallow vs Deep Copying of Python Objects
A shallow copy means constructing a new collection object and then populating it with references to the child objects found in the original....
Read more >
The Best Way to Deep Copy an Object in JavaScript - Code
The function will not be available in the copied object. Thus, this method achieves deep copy only if there is no function within...
Read more >
Shallow and deep copy in Python: copy(), deepcopy()
In Python, you can make a shallow and deep copy with the copy() method of list , dictionary, etc., or the copy() and...
Read more >
dataclasses — Data Classes — Python 3.11.1 documentation
Each dataclass is converted to a tuple of its field values. dataclasses, dicts, lists, and tuples are recursed into. Other objects are copied...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found