How to Create a screen and name it. Do you have a better method?

Ok, python people.

bpy.ops.screen.new() 

Accepts NO parameters. Useful parameters, like a name…

Similarly,

x = bpy.ops.screen.new()

Does NOT return an object -x- which, in turn, can be named.

So!
Here’s what I had to do:
Create a set variable of the screens.
Create new screen
Hash the difference between the set and the new screen set
Name the odd one out.


screen_set = bpy.data.screens.items()
bpy.ops.screen.new()
new_screen = [x for x in bpy.data.screens.items() if x not in screen_set]
bpy.data.screens[new_screen[0][0]].name = 'Pudding'

That seems like a lot of faffin’ about to name a screen.
A more elegant means exists, perhaps?

I think you can do something like this.

 bpy.data.screens.new(name='my_new_screen')

Hi, thanks for taking the time.

Yeah… One would THINK you could do something like that.
Just to end all doubt…
One can’t

bpy.data.screenS does not have a new() method
bpy.ops.screen is where one news up a new screen.
As I said, it does not accept parameters.

I was on my ipad so couldn’t test the code ,but your right you can’t do bpy.data.screens.new(). Have no clue how you could do it. You would think it would be fairly simple ,but doesn’t look like it.